Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Docker container #527

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions Dockerfiles/Dockerfile.fastp
Original file line number Diff line number Diff line change
@@ -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 "<samplename>-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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about alpine which is more smaller

LABEL org.opencontainers.image.authors="[email protected]"

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 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nowhere to use 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 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to use ln -s

&& 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"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down