Skip to content

Commit

Permalink
add qsv to docker image (#26)
Browse files Browse the repository at this point in the history
* update miniconda version

* add script to install qsv from tagged release; call in Dockerfile

add script to install qsv within docker image from tagged release (not yet available via apt repo)

* bump actions/checkout v3 -> v4

* bump Ubuntu baseimage for this (base)image: jammy-20230126 -> jammy-20240227
  • Loading branch information
tomkinsc committed Mar 8, 2024
1 parent 13c4e3c commit 2615746
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:jammy-20230126
FROM ubuntu:jammy-20240227

LABEL maintainer "viral-ngs team <viral-ngs@broadinstitute.org>"

Expand All @@ -23,6 +23,9 @@ RUN /opt/docker/install-udocker.sh
# install DNAnexus SDK and UA
RUN /opt/docker/install-dnanexus-cli.sh

# install qsv (binary for manipulation and query of tabular data files like tsv)
RUN /opt/docker/install-qsv.sh

# install miniconda3 with our default channels and no other packages
ENV MINICONDA_PATH="/opt/miniconda"
RUN /opt/docker/install-miniconda.sh
Expand Down
2 changes: 1 addition & 1 deletion install-miniconda.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e -o pipefail

MINICONDA_VERSION="py310_23.1.0-1"
MINICONDA_VERSION="py310_24.1.2-0"
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh"

# download and run miniconda installer script
Expand Down
75 changes: 75 additions & 0 deletions install-qsv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

# This installs qsv:
# "a command line program for querying, indexing, slicing, analyzing, filtering, enriching,
# transforming, sorting, validating & joining CSV files"
#
# Additional information available here:
# https://github.com/jqnatividad/qsv
#
# Additional information on available releases (including the latest versions) available here:
# https://github.com/jqnatividad/qsv/releases

QSV_BINARY=qsvlite # "qsv" is the binary with all features enabled; "qsvlite" has extra features disabled and is much smaller in size
QSV_VERSION=0.123.0

case "$(uname -m)" in
x86_64)
CPU_ARCH="x86_64"
;;
arm64 | aarch64)
CPU_ARCH="aarch64" #"aarch64" for Apple Silicon and other ARM-based CPUs
;;
*)
CPU_ARCH="unknown"
echo "Unknown CPU architecture returned by uname -m: '${CPU_ARCH}'" >&2
exit 1
;;
esac

case "$(uname -s)" in
Linux)
OS_BUILD_TYPE="unknown-linux-gnu" # "unknown-linux-musl" for Linux platforms where libc compatability is an issue, otherwise "unknown-linux-gnu"
;;
Darwin)
OS_BUILD_TYPE="apple-darwin"
;;
*)
OS_BUILD_TYPE="unknown"
echo "Unknown OS type returned by uname -s: '${OS_BUILD_TYPE}'" >&2
exit 1
;;
esac

if ! command -v curl &> /dev/null; then
echo "curl is required but it does not appear to be installed" >&2
exit 1
fi

PACKAGE_ZIP=qsv-${QSV_VERSION}-${CPU_ARCH}-${OS_BUILD_TYPE}.zip

echo "Downloading binary for ${OS_BUILD_TYPE} built for ${CPU_ARCH}: ${PACKAGE_ZIP}"
curl --silent --location --output $PACKAGE_ZIP https://github.com/jqnatividad/qsv/releases/download/${QSV_VERSION}/${PACKAGE_ZIP}

# unzip only the qsv binary to its final location (the zip archive also contains alternate builds)
unzip -o -d /usr/local/bin $PACKAGE_ZIP ${QSV_BINARY}
rm $PACKAGE_ZIP

chmod 755 /usr/local/bin/${QSV_BINARY}

# if copying in an alternate build of qsv, symlink it to "qsv"
if [[ "$QSV_BINARY" != "qsv" ]]; then
if [ ! -f /usr/local/bin/qsv ]; then
ln -s /usr/local/bin/${QSV_BINARY} /usr/local/bin/qsv
fi
fi

hash -r

if ! command -v qsv &> /dev/null; then
echo "The qsv installation seems to have failed" >&2
exit 1
else
echo "qsv installation successful."
fi

0 comments on commit 2615746

Please sign in to comment.