comparison Dockerfile @ 0:8e7a84e62b43 draft

planemo upload commit e734452c606dba89b6fe58c90c5f38e5ea067edd
author galaxytrakr
date Fri, 13 Mar 2026 21:22:16 +0000
parents
children ea58bc28a64f
comparison
equal deleted inserted replaced
-1:000000000000 0:8e7a84e62b43
1 # =========================
2 # CSP2 for Galaxy/AWS Batch (offline Nextflow)
3 # =========================
4
5 # ---------- Build stage ----------
6 FROM ubuntu:focal AS build
7
8 ARG DEBIAN_FRONTEND=noninteractive
9 ARG CSP2_VER="0.9.0"
10 ARG BEDTOOLS_VER="2.31.1"
11 ARG MUMMER_VER="4.0.0"
12 ARG SKESA_VER="2.4.0"
13 ARG MASH_VER="2.3"
14 ARG BBMAP_VER="38.90"
15 ARG PYTHON_VER="3.8"
16 ARG SOURCEFORGE_MIRROR="psychz"
17 ARG IQTREE_VER="2.0.6"
18
19 # Use a stable working directory
20 WORKDIR /workspace
21
22 # Base build deps (include Java to verify/prewarm Nextflow here)
23 RUN apt-get update && apt-get install -y --no-install-recommends \
24 tzdata gpg-agent software-properties-common build-essential \
25 zlib1g-dev libghc-bzlib-dev liblzma-dev wget ca-certificates \
26 cmake curl git xz-utils openjdk-17-jre-headless \
27 && rm -rf /var/lib/apt/lists/*
28
29 # Python venv for runtime tools
30 RUN add-apt-repository 'ppa:deadsnakes/ppa' && apt-get update && \
31 apt-get install -y --no-install-recommends \
32 python${PYTHON_VER} python${PYTHON_VER}-dev python${PYTHON_VER}-venv \
33 && python${PYTHON_VER} -m venv --copies /opt/venv \
34 && rm -rf /var/lib/apt/lists/*
35
36 ENV PATH="/opt/venv/bin:${PATH}"
37
38 # Core Python packages
39 RUN pip install --no-cache-dir -U \
40 pandas~=1.2.0 pybedtools refchooser scikit-learn
41
42 # ---- Fetch sources/artifacts ----
43
44 # bedtools
45 ADD https://github.com/arq5x/bedtools2/archive/refs/tags/v${BEDTOOLS_VER}.tar.gz .
46 # mummer
47 ADD https://github.com/mummer4/mummer/releases/download/v${MUMMER_VER}rc1/mummer-${MUMMER_VER}rc1.tar.gz .
48 # skesa prebuilt bins
49 ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/skesa.centos.7.7 .
50 ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/gfa_connector.centos7.7 .
51 ADD https://github.com/ncbi/SKESA/releases/download/${SKESA_VER}/kmercounter.centos7.7 .
52 # mash
53 ADD https://github.com/marbl/Mash/releases/download/v${MASH_VER}/mash-Linux64-v${MASH_VER}.tar .
54 # iqtree2
55 ADD https://github.com/Cibiv/IQ-TREE/releases/download/v${IQTREE_VER}/iqtree-${IQTREE_VER}-Linux.tar.gz .
56
57 # ---- Build/install tools into /usr/local ----
58 # bedtools
59 RUN tar -xzf v${BEDTOOLS_VER}.tar.gz && rm v${BEDTOOLS_VER}.tar.gz && \
60 cd bedtools2-${BEDTOOLS_VER} && make -j && make install
61
62 # Install MUMmer and copy Perl modules where dnadiff expects them
63 RUN tar -xvf mummer-${MUMMER_VER}rc1.tar.gz && rm mummer-${MUMMER_VER}rc1.tar.gz && \
64 cd mummer-${MUMMER_VER}rc1 && \
65 ./configure --prefix=/usr/local && make -j && make install && ldconfig && \
66 mkdir -p /usr/local/lib/mummer && cp -a scripts/*.pm /usr/local/lib/mummer/
67
68 # skesa tools (rename and install)
69 RUN install -m 0755 skesa.centos.7.7 /usr/local/bin/skesa && \
70 install -m 0755 gfa_connector.centos7.7 /usr/local/bin/gfa_connector && \
71 install -m 0755 kmercounter.centos7.7 /usr/local/bin/kmercounter
72
73 # mash
74 RUN tar -xvf mash-Linux64-v${MASH_VER}.tar && \
75 install -m 0755 mash-Linux64-v${MASH_VER}/mash /usr/local/bin/mash
76
77 # bbmap (grab all scripts/binaries)
78 RUN wget -O BBMap_${BBMAP_VER}.tar.gz \
79 "https://sourceforge.net/projects/bbmap/files/BBMap_${BBMAP_VER}.tar.gz/download?use_mirror=${SOURCEFORGE_MIRROR}" && \
80 tar -xvf BBMap_${BBMAP_VER}.tar.gz && \
81 cp -a bbmap/* /usr/local/bin/ && \
82 rm -rf bbmap BBMap_${BBMAP_VER}.tar.gz
83
84 # iqtree2
85 RUN tar -xzf iqtree-${IQTREE_VER}-Linux.tar.gz && \
86 install -m 0755 iqtree-${IQTREE_VER}-Linux/bin/iqtree2 /usr/local/bin/iqtree && \
87 rm -rf iqtree-${IQTREE_VER}-Linux iqtree-${IQTREE_VER}-Linux.tar.gz
88
89 # choose a version
90 ARG NXF_VER="25.04.7"
91
92 # install that exact launcher & prewarm framework into /opt/nextflow
93 RUN curl -fsSL -o /usr/local/bin/nextflow \
94 "https://github.com/nextflow-io/nextflow/releases/download/v${NXF_VER}/nextflow" \
95 && chmod 0755 /usr/local/bin/nextflow \
96 && mkdir -p /opt/nextflow \
97 && chmod -R a+rwX /opt/nextflow \
98 && NXF_HOME=/opt/nextflow NXF_OFFLINE=false NXF_VER=${NXF_VER} /usr/local/bin/nextflow -version \
99 && ls -l /usr/local/bin/nextflow
100
101 # ---------- Runtime stage ----------
102 FROM ubuntu:focal AS runtime
103
104 ARG DEBIAN_FRONTEND=noninteractive
105 ARG CSP2_VER="0.9.0"
106
107 # Python venv for runtime tools
108 # Lean runtime libs + Python3.8 + Perl (no PPAs)
109 RUN apt-get update && apt-get install -y --no-install-recommends \
110 ca-certificates openjdk-17-jre-headless bash tzdata perl perl-modules-5.30 \
111 libgomp1 liblzma5 zlib1g libbz2-1.0 coreutils make curl gawk \
112 python3.8 python3.8-venv python3.8-distutils \
113 && rm -rf /var/lib/apt/lists/*
114
115 # Bring over tools and Python venv
116 COPY --from=build /usr/local/bin/ /usr/local/bin/
117 COPY --from=build /usr/local/libexec/mummer /usr/local/libexec/mummer
118 COPY --from=build /usr/local/share/ /usr/local/share/
119 COPY --from=build /opt/venv /opt/venv
120
121 # Bring over Nextflow launcher and baked framework cache
122 COPY --from=build /usr/local/bin/nextflow /usr/local/bin/nextflow
123 COPY --from=build /opt/nextflow /opt/nextflow
124
125 # Ensure any UID (Galaxy user) can execute nextflow and write minimal state into the cache
126 RUN chmod 0755 /usr/local/bin/nextflow \
127 && chmod -R a+rwX /opt/nextflow
128
129 # Bring the modules into the runtime image (if not already)
130 COPY --from=build /usr/local/lib/mummer /usr/local/lib/mummer
131
132 # Bring MUMmer shared libs into the runtime image
133 COPY --from=build /usr/local/lib /usr/local/lib
134
135 # Make sure dynamic linker can find them
136 RUN ldconfig || true
137
138 # Belt-and-suspenders for minimal images
139 ENV LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}"
140
141 # Permissions: allow any UID to read/execute the libs
142 RUN chmod -R a+rX /usr/local/lib
143
144 # Make modules readable by any UID; create compatibility symlink if needed
145 RUN chmod -R a+rX /usr/local/lib/mummer /usr/local/libexec/mummer && \
146 test -d /usr/local/lib/mummer || ln -s /usr/local/libexec/mummer /usr/local/lib/mummer
147
148 # Ensure the common mummer executables are executable by all
149 RUN chmod 0755 /usr/local/bin/dnadiff /usr/local/bin/nucmer /usr/local/bin/promer /usr/local/bin/show-snps || true
150
151 # Help Perl find modules regardless of layout
152 ENV PERL5LIB="/usr/local/lib/mummer:/usr/local/libexec/mummer:/usr/local/share/mummer:${PERL5LIB}"
153
154 # Runtime environment
155 ENV PATH="/opt/venv/bin:/usr/local/bin:${PATH}" \
156 LC_ALL=C \
157 NXF_HOME=/opt/nextflow \
158 NXF_OFFLINE=true \
159 CSP2_VER=${CSP2_VER}
160
161 # Install the CSP2 pipeline under /opt/csp2 (avoid /app which Galaxy mounts)
162 WORKDIR /opt/csp2
163
164 # Copy your pipeline (these paths must exist in the build context)
165 COPY bin ./bin
166 COPY conf ./conf
167 COPY subworkflows ./subworkflows
168 COPY CSP2.nf ./CSP2.nf
169 COPY nextflow.config ./nextflow.config
170
171 # permissions for arbitrary UID
172 RUN chmod -R a+rX /opt/csp2 && chmod -R a+rX /opt/nextflow
173
174 # IMPORTANT: No ENTRYPOINT for Galaxy/AWS Batch. Neutral CMD.
175 CMD ["/bin/bash"]