Base image is python:3.11-bookworm with cutadapt(v4.9), TrimGalore (v0.6.10), FastQC (v0.12.1).
596
Dockerfile v2.3 cutadapt==4.9 / TrimGalore-0.6.10 / FastQC 0.12.1
############################
# Builder: build wheels (src→wheel)
############################
FROM python:3.11-bookworm AS wheels
ARG CUTADAPT_VERSION=4.9
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -eux; \
apt-get update; \
apt-get -y --no-install-recommends dist-upgrade; \
apt-get -o APT::Keep-Downloaded-Packages=false \
-o Dir::Cache::Archives=/tmp \
install -y --no-install-recommends build-essential python3-dev cython3; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
# setuptools のCVE回避(>=78.1.1)
RUN python -m pip install --upgrade --no-cache-dir pip wheel "setuptools>=78.1.1"
# 依存もまとめてwheel化
RUN pip wheel --no-cache-dir --wheel-dir /wheels "cutadapt==${CUTADAPT_VERSION}"
############################
# Runtime
############################
FROM python:3.11-slim-bookworm
LABEL maintainer="albicans" \
org.opencontainers.image.title="trim_galore" \
org.opencontainers.image.version="2.3" \
org.opencontainers.image.description="Trim Galore + (optional) FastQC + Cutadapt runtime" \
org.opencontainers.image.source="https://hub.docker.com/r/albicans2021/trim_galore"
# --- Build args / options ---
ARG UID=1000
ARG GID=1000
ARG CUTADAPT_VERSION=4.9
# FastQC を含めるか(true/false)
ARG WITH_FASTQC=true
# FastQC 0.12.1(任意で変更)
ARG FASTQC_VER="0.12.1"
ARG FASTQC_URL="https://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v${FASTQC_VER}.zip"
# SHA256 を指定したい場合に渡す(未設定なら検証スキップ)
ARG FASTQC_SHA256=""
ENV PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
LC_ALL=C.UTF-8 LANG=C.UTF-8 \
TZ=Asia/Tokyo \
PATH="/usr/local/FastQC:${PATH}"
# --- OS セキュリティアップデート & 最小導入 ---
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -eux; \
apt-get update; \
apt-get -y --no-install-recommends dist-upgrade; \
apt-get -o APT::Keep-Downloaded-Packages=false \
-o Dir::Cache::Archives=/tmp \
install -y --no-install-recommends ca-certificates; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
# Python toolchain更新(setuptoolsのCVE回避、ランタイム側にも常駐)
RUN python -m pip install --upgrade --no-cache-dir pip wheel "setuptools>=78.1.1"
# cutadapt を wheels からオフライン導入
COPY --from=wheels /wheels /wheels
RUN pip install --no-index --find-links=/wheels "cutadapt==${CUTADAPT_VERSION}" && rm -rf /wheels
# --- Trim Galore(Perlスクリプト) ---
COPY ./tools/TrimGalore-0.6.10/trim_galore /usr/local/bin/trim_galore
RUN chmod +x /usr/local/bin/trim_galore
# --- FastQC(任意; WITH_FASTQC=true の場合のみ導入) ---
# zip は ADD で取得(curl/unzip不要)
ADD ${FASTQC_URL} /tmp/fastqc.zip
# 解凍は Python の zipfile を使用。FastQC動作用の Perlモジュール と Java を条件導入
RUN set -eux; \
if [ "${WITH_FASTQC}" = "true" ]; then \
if [ -n "${FASTQC_SHA256}" ]; then \
echo "${FASTQC_SHA256} /tmp/fastqc.zip" | sha256sum -c -; \
else \
echo "FASTQC_SHA256 not set; skipping checksum verification"; \
fi; \
python -c "import zipfile,os; z=zipfile.ZipFile('/tmp/fastqc.zip'); z.extractall('/usr/local'); z.close(); os.remove('/tmp/fastqc.zip')"; \
chmod +x /usr/local/FastQC/fastqc; \
ln -sf /usr/local/FastQC/fastqc /usr/bin/fastqc; \
# ★ FastQCのPerl依存(FindBin等)は perl-modules-5.36 に含まれる
apt-get update; \
apt-get -y --no-install-recommends install perl-modules-5.36 openjdk-17-jre-headless; \
apt-get clean; rm -rf /var/lib/apt/lists/*; \
else \
rm -f /tmp/fastqc.zip || true; \
fi
# --- 使わないパッケージのパージ(存在すれば) ---
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get -y purge --auto-remove --allow-remove-essential \
tar sqlite3 cups gnupg2 || true; \
apt-get -y autoremove --purge || true; \
apt-get clean; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
# --- Non-root user ---
RUN set -eux; groupadd -g "${GID}" main; useradd -m -s /bin/bash -u "${UID}" -g "${GID}" main
USER main
WORKDIR /home/main
# --- Healthcheck(FastQC有無を考慮) ---
HEALTHCHECK --interval=1m --timeout=10s --start-period=20s --retries=3 \
CMD bash -lc 'trim_galore --version >/dev/null 2>&1 && { [ "${WITH_FASTQC}" = "true" ] && fastqc --version >/dev/null 2>&1 || true; } || exit 1'
CMD ["trim_galore", "--help"]
Dockerfile v1.5
# -------------- Builder Stage --------------
FROM ubuntu:22.04 AS builder
LABEL maintainer="albicans" \
image_name="albicans2021/trim_galore" \
version="1.5"
# 必要なパッケージをインストール(不要な依存関係は入れない)
RUN apt-get update && apt-get install -y --no-install-recommends \
perl unzip default-jre #python3 python3-pip \
&& pip install cutadapt \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# FastQC のインストール
COPY ./tools/fastqc_v0.11.9.zip /usr/local
RUN unzip /usr/local/fastqc_v0.11.9.zip -d /usr/local \
&& rm /usr/local/fastqc_v0.11.9.zip \
&& chmod +x /usr/local/FastQC/fastqc
# Trim Galore のインストール
COPY ./tools/TrimGalore-0.6.10/trim_galore /usr/local/bin
RUN chmod +x /usr/local/bin/trim_galore
# -------------- Runtime Stage --------------
FROM python:3.9-slim-buster AS runtime
# 必要なランタイムパッケージのみをインストール
RUN apt-get update && apt-get install -y --no-install-recommends \
perl default-jre \
&& pip install cutadapt \
&& ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
&& echo "Asia/Tokyo" > /etc/timezone \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# FastQC & Trim Galore のみをコピー(Python はランタイムでインストール済み)
COPY --from=builder /usr/local/FastQC /usr/local/FastQC
COPY --from=builder /usr/local/bin/trim_galore /usr/local/bin/trim_galore
#COPY --from=builder /usr/bin/python3 /usr/bin/python3
# FastQC のシンボリックリンクを作成
RUN ln -s /usr/local/FastQC/fastqc /usr/bin/fastqc
# ユーザー作成
RUN groupadd -g 1000 main && useradd -m -s /bin/bash -u 1000 -g 1000 main
# エントリーポイントを設定
USER main
WORKDIR /home/main
Content type
Image
Digest
sha256:30b7abbd7…
Size
165.1 MB
Last updated
about 1 year ago
docker pull albicans2021/trim_galore