diff --git a/Dockerfiles/Dockerfile.fastp b/Dockerfiles/Dockerfile.fastp new file mode 100644 index 0000000..577e356 --- /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.4 -t fastp:0.23.4 -f ./Dockerfile.fastp . +# +# OR to change the build user id to run as yourself, do this: +# 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) +# 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.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.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 myUID 2000 myGID 3000 for use in Kubernetes (and avoid running as root) +ARG USER=appuser +ARG USERGROUP=appgroup +ARG myUID=2000 +ARG myGID=3000 +RUN groupadd -r -g ${myGID} ${USERGROUP} && useradd -g ${myGID} --myUID=${myUID} ${USER} +# USER appuser:appgroup +USER ${myUID}:${myGID} +ENTRYPOINT ["/app/fastp"] diff --git a/README.md b/README.md index 8c0465b..00701cc 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.4" +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.