Mercurial > repos > galaxytrakr > mitokmer
annotate Dockerfile @ 1:e6b5e7a0d7e7 draft
planemo upload commit 11a773626bf7d7c06186e587f62f0aacfa43541a
| author | galaxytrakr |
|---|---|
| date | Fri, 11 Sep 2026 22:01:39 +0000 |
| parents | adc887a1a6de |
| children | dd206296acbf |
| rev | line source |
|---|---|
|
0
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
1 # ============================================================= |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
2 # Dockerfile for mitokmer2 (compatible with Galaxy/AWS Batch) |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
3 # ============================================================= |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
4 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
5 # ---------- Build Stage ---------- |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
6 FROM ubuntu:focal AS build |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
7 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
8 ARG DEBIAN_FRONTEND=noninteractive |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
9 ARG PYTHON_VER="3.8" |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
10 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
11 WORKDIR /workspace |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
12 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
13 # Build dependencies: compiler, zlib dev headers, git, Python |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
14 RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
15 build-essential \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
16 g++ \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
17 git \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
18 wget \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
19 zlib1g-dev \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
20 ca-certificates \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
21 python${PYTHON_VER} \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
22 python${PYTHON_VER}-dev \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
23 python${PYTHON_VER}-venv \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
24 && rm -rf /var/lib/apt/lists/* |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
25 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
26 # Create Python virtual environment using --copies so symlinks |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
27 # do not break when the venv is copied to the runtime stage |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
28 RUN python${PYTHON_VER} -m venv --copies /opt/venv |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
29 ENV PATH="/opt/venv/bin:${PATH}" |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
30 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
31 # Install Python dependencies |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
32 RUN pip install --no-cache-dir -U pip && \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
33 pip install --no-cache-dir pandas |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
34 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
35 # Clone mitokmer2 source code from GitHub |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
36 RUN git clone https://github.com/mmammel8/mitokmer2.git /opt/mitokmer2 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
37 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
38 WORKDIR /opt/mitokmer2 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
39 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
40 # Compile the C++ read-screening program |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
41 # kmer_read_1.cpp -> kmerread |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
42 RUN g++ -O3 kmer_read_1.cpp -o kmerread -lz && \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
43 chmod +x kmerread |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
44 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
45 # Install any Python requirements declared in the repo |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
46 RUN if [ -f requirements.txt ]; then \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
47 pip install --no-cache-dir -r requirements.txt; \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
48 fi |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
49 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
50 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
51 # ---------- Runtime Stage ---------- |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
52 FROM ubuntu:focal AS runtime |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
53 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
54 ARG DEBIAN_FRONTEND=noninteractive |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
55 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
56 # Lean runtime: zlib shared library + Python runtime only |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
57 RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
58 zlib1g \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
59 libbz2-1.0 \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
60 ca-certificates \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
61 python3.8 \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
62 python3.8-venv \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
63 python3.8-distutils \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
64 && rm -rf /var/lib/apt/lists/* |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
65 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
66 # Copy compiled binary from build stage |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
67 COPY --from=build /opt/mitokmer2/kmerread /usr/local/bin/kmerread |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
68 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
69 # Copy Python scripts and supporting files from build stage |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
70 COPY --from=build /opt/mitokmer2 /opt/mitokmer2 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
71 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
72 # Copy Python virtual environment from build stage |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
73 # --copies in the build stage ensures no broken symlinks here |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
74 COPY --from=build /opt/venv /opt/venv |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
75 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
76 # Refresh the dynamic linker cache so zlib and other shared |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
77 # libraries are found at runtime |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
78 RUN ldconfig || true |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
79 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
80 # Ensure all users (including arbitrary Galaxy UIDs) can |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
81 # read and execute binaries, scripts, and the venv |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
82 RUN chmod a+rx /usr/local/bin/kmerread && \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
83 chmod -R a+rX /opt/mitokmer2 && \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
84 chmod -R a+rX /opt/venv |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
85 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
86 # Runtime environment |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
87 ENV PATH="/opt/venv/bin:/opt/mitokmer2:/usr/local/bin:${PATH}" \ |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
88 LC_ALL=C |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
89 |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
90 # IMPORTANT: No ENTRYPOINT for Galaxy/AWS Batch. Neutral CMD. |
|
adc887a1a6de
planemo upload commit 927c4ee71df7d19ceb10446a04618af22c99d839
galaxytrakr
parents:
diff
changeset
|
91 CMD ["/bin/bash"] |
