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