From a9c65639085dcd5409b0a0ea4bdd221ea4b39998 Mon Sep 17 00:00:00 2001 From: maol-corteva <83616392+maol-corteva@users.noreply.github.com> Date: Tue, 6 Dec 2022 11:19:14 -0600 Subject: [PATCH 1/4] Create Dockerfile.fastp --- Dockerfiles/Dockerfile.fastp | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Dockerfiles/Dockerfile.fastp diff --git a/Dockerfiles/Dockerfile.fastp b/Dockerfiles/Dockerfile.fastp new file mode 100644 index 00000000..38716dba --- /dev/null +++ b/Dockerfiles/Dockerfile.fastp @@ -0,0 +1,56 @@ +############# +# Dockerfile to build container image for fastp : a bionformatics NGS QC/adapter-trim tool +# See Docs and Source code at: https://github.com/OpenGene/fastp +# Example unix cmdline and parameters: +# fastp -i raw.fq -o ./clean.fq -h "-fastp_report" -w12 -e 25 -l 40 -y -5 -3 -W4 -M20 \ +# --overrepresentation_analysis -P 100 --dont_eval_duplication -x +# Build Image with (and specify tagged version): +# docker build --build-arg FP_VERSION=0.23.2 -t fastp:0.23.2 -f ./Dockerfile.fastp . +# +# OR to change the build user id to run as yourself, do this: +# export UID=$(id -u) ; export GID=$(id -g) # See below for details setting the user +# docker build --build-arg USER=$UID:$GID FP_VERSION=0.23.2 -t fastp:0.23.2 -f ./Dockerfile.fastp . +# Run in iteractive mode like: +# docker run -it --rm --network="host" --cpus=2 -m 64000m -v ${PWD}:${PWD} -w ${PWD} --entrypoint /bin/bash my_image +# ... where "my_image" is the full length image name (i.e: fastp:latest) or the specific "IMAGE ID" in your docker setup (docker image ls) +# OR run as default and it will use the internal entrypoint: +# docker run -it --rm --network="host" -v ${PWD}:${PWD} -w ${PWD} my_image --flags +# Here is a full example with flags, running within the Docker: +# /app/fastp -i testsample-pairsR1.fq.gz -I testsample-pairsR2.fq.gz -R testsample_fastP -h testsample.fastp_report.html +# --thread 12 --detect_adapter_for_pe --dedup --dup_calc_accuracy 4 -e 25 -l 35 --trim_poly_g --trim_poly_x -p -P 100 +############# + +# FROM scratch +FROM ubuntu:20.04 +LABEL org.opencontainers.image.authors="mauricio.larota@corteva.com" + +ARG DEBIAN_FRONTEND="noninteractive" +ARG TZ="UTC" +ENV TZ="${TZ}" + +# Update the repository sources list +RUN apt-get update && apt-get install -y \ + wget \ + nano \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + + +# Verified version of 'fastp' to use. 0.23.2 as of Nov 2022. Provide as cmdline argument to override +ARG FP_VERSION=0.23.2 + +# Get the precompiled package version wanted +# fastp v0.23.1 +WORKDIR /app +RUN wget http://opengene.org/fastp/fastp.${FP_VERSION} \ + && mv fastp.${FP_VERSION} fastp \ + && chmod a+x ./fastp + +# Set run user/group as uid 2000 gid 3000 for use in KubeFarm +ARG USER=appuser +ARG USERGROUP=appgroup +ARG UID=2000 +ARG GID=3000 +RUN groupadd -r -g ${GID} ${USERGROUP} && useradd -g ${GID} --uid=${UID} ${USER} +# USER appuser:appgroup +USER ${UID}:${GID} +ENTRYPOINT ["/app/fastp"] From 2d28142b6443ff295581b5dcc5e6f7c94db51a4b Mon Sep 17 00:00:00 2001 From: maol-corteva <83616392+maol-corteva@users.noreply.github.com> Date: Tue, 6 Dec 2022 11:28:03 -0600 Subject: [PATCH 2/4] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 8c0465b3..f5fa4983 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,15 @@ wget http://opengene.org/fastp/fastp.0.23.1 mv fastp.0.23.1 fastp chmod a+x ./fastp ``` + +## Use a Docker container +The image is built with Ubuntu 20.04 as base. See Dockerfile.fastp in Dockerfiles folder +```shell +git clone https://github.com/OpenGene/fastp.git +export FP_VERSION="0.23.2" +docker build --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg FP_VERSION=${FP_VERSION} --tag fastp:${FP_VERSION} --file ./Dockerfiles/Dockerfile.fastp . +``` + ## or compile from source `fastp` depends on `libdeflate` and `libisal`, while `libisal` is not compatible with gcc 4.8. If you use gcc 4.8, your fastp will fail to run. Please upgrade your gcc before you build the libraries and fastp. From 316fd3fab3409fbcc36d3676e6ca27876c74aea8 Mon Sep 17 00:00:00 2001 From: maol-corteva <83616392+maol-corteva@users.noreply.github.com> Date: Wed, 11 Oct 2023 12:58:21 -0500 Subject: [PATCH 3/4] Update README.md to v0.23.4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5fa4983..00701cca 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ chmod a+x ./fastp The image is built with Ubuntu 20.04 as base. See Dockerfile.fastp in Dockerfiles folder ```shell git clone https://github.com/OpenGene/fastp.git -export FP_VERSION="0.23.2" +export FP_VERSION="0.23.4" docker build --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg FP_VERSION=${FP_VERSION} --tag fastp:${FP_VERSION} --file ./Dockerfiles/Dockerfile.fastp . ``` From ee0a81bb9fd9c6d12f051df4d13ac09b0fa9f603 Mon Sep 17 00:00:00 2001 From: maol-corteva <83616392+maol-corteva@users.noreply.github.com> Date: Wed, 11 Oct 2023 13:13:26 -0500 Subject: [PATCH 4/4] Update Dockerfile to 0.23.4 rename UID var to myUID --- Dockerfiles/Dockerfile.fastp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Dockerfiles/Dockerfile.fastp b/Dockerfiles/Dockerfile.fastp index 38716dba..577e3567 100644 --- a/Dockerfiles/Dockerfile.fastp +++ b/Dockerfiles/Dockerfile.fastp @@ -5,11 +5,11 @@ # fastp -i raw.fq -o ./clean.fq -h "-fastp_report" -w12 -e 25 -l 40 -y -5 -3 -W4 -M20 \ # --overrepresentation_analysis -P 100 --dont_eval_duplication -x # Build Image with (and specify tagged version): -# docker build --build-arg FP_VERSION=0.23.2 -t fastp:0.23.2 -f ./Dockerfile.fastp . +# docker build --build-arg FP_VERSION=0.23.4 -t fastp:0.23.4 -f ./Dockerfile.fastp . # # OR to change the build user id to run as yourself, do this: -# export UID=$(id -u) ; export GID=$(id -g) # See below for details setting the user -# docker build --build-arg USER=$UID:$GID FP_VERSION=0.23.2 -t fastp:0.23.2 -f ./Dockerfile.fastp . +# export myUID=$(id -u) ; export myGID=$(id -g) # See below for details setting the user +# docker build --build-arg USER=$myUID:$myGID FP_VERSION=0.23.4 -t fastp:0.23.4 -f ./Dockerfile.fastp . # Run in iteractive mode like: # docker run -it --rm --network="host" --cpus=2 -m 64000m -v ${PWD}:${PWD} -w ${PWD} --entrypoint /bin/bash my_image # ... where "my_image" is the full length image name (i.e: fastp:latest) or the specific "IMAGE ID" in your docker setup (docker image ls) @@ -35,22 +35,22 @@ RUN apt-get update && apt-get install -y \ && apt-get clean && rm -rf /var/lib/apt/lists/* -# Verified version of 'fastp' to use. 0.23.2 as of Nov 2022. Provide as cmdline argument to override -ARG FP_VERSION=0.23.2 +# Verified version of 'fastp' to use. 0.23.4 as of Q3 2023. Provide as cmdline argument to override. Assumes a Linux 64bit ELF binary +ARG FP_VERSION=0.23.4 # Get the precompiled package version wanted -# fastp v0.23.1 +# fastp v0.23.4 WORKDIR /app RUN wget http://opengene.org/fastp/fastp.${FP_VERSION} \ && mv fastp.${FP_VERSION} fastp \ && chmod a+x ./fastp -# Set run user/group as uid 2000 gid 3000 for use in KubeFarm +# Set run user/group as myUID 2000 myGID 3000 for use in Kubernetes (and avoid running as root) ARG USER=appuser ARG USERGROUP=appgroup -ARG UID=2000 -ARG GID=3000 -RUN groupadd -r -g ${GID} ${USERGROUP} && useradd -g ${GID} --uid=${UID} ${USER} +ARG myUID=2000 +ARG myGID=3000 +RUN groupadd -r -g ${myGID} ${USERGROUP} && useradd -g ${myGID} --myUID=${myUID} ${USER} # USER appuser:appgroup -USER ${UID}:${GID} +USER ${myUID}:${myGID} ENTRYPOINT ["/app/fastp"]