comparison Dockerfile @ 9:4c4899031795 draft

planemo upload commit fcafae43456eb929e62b5c879ac954f75745bbf8
author galaxytrakr
date Fri, 15 May 2026 11:44:48 +0000
parents
children 6cba046e4aaa
comparison
equal deleted inserted replaced
8:e3b5ed54af18 9:4c4899031795
1 # Multi-stage Dockerfile for SeqSero2S
2 # Default build: docker build -t seqsero2s:latest .
3 # Test build: docker build --target test -t seqsero2s:test .
4
5 # ============================================================================
6 # Stage 1: Base image with mambaforge for faster dependency resolution
7 # ============================================================================
8 FROM condaforge/mambaforge:latest AS base
9
10 LABEL maintainer="SeqSero2S Maintainers"
11 LABEL description="Simplified Salmonella serotype prediction from genome sequencing data"
12
13 # Set environment variables to reduce conda output and ensure non-interactive
14 # Disable SSL verification for VPN environments
15 ENV CONDA_ALWAYS_YES=true \
16 CONDA_AUTO_UPDATE_CONDA=false \
17 DEBIAN_FRONTEND=noninteractive
18
19 # Configure conda to skip SSL verification
20 RUN conda config --set ssl_verify false
21
22 # ============================================================================
23 # Stage 2: Builder - Install all dependencies and SeqSero2S
24 # ============================================================================
25 FROM base AS builder
26
27 # Update base packages and install build essentials
28 RUN apt-get update && \
29 apt-get install -y --no-install-recommends \
30 wget \
31 ca-certificates \
32 bash \
33 && apt-get clean && \
34 rm -rf /var/lib/apt/lists/*
35
36 # Copy the patch script
37 COPY patch_stringmlst.sh /tmp/patch_stringmlst.sh
38 RUN chmod +x /tmp/patch_stringmlst.sh
39
40 # Create conda environment with all dependencies
41 # Using mamba for faster dependency resolution
42 RUN mamba create -n seqsero2s -c conda-forge -c bioconda \
43 python>=3 \
44 pip \
45 setuptools \
46 blast>=2.2 \
47 zstd \
48 samtools \
49 bedtools>=2.17 \
50 sra-tools>=2.8 \
51 spades>=3.9 \
52 salmid \
53 bwa>=0.7 \
54 seqtk>=1.3 \
55 stringmlst>=0.6 \
56 mlst>=2.32.2 \
57 perl-list-moreutils \
58 && mamba clean -afy
59
60 # Install SeqSero2S from local fork
61 WORKDIR /tmp/build
62
63 # Copy local SeqSero2S directory
64 COPY SeqSero2S /tmp/build/SeqSero2S
65
66 # Install SeqSero2S
67 RUN cd SeqSero2S && \
68 /opt/conda/envs/seqsero2s/bin/python -m pip install . -vv --no-deps --no-build-isolation --no-cache-dir
69
70 # Apply the stringMLST.py patch (from the conda recipe)
71 # The patch replaces dbPrefix reference with cwd to avoid path issues
72 RUN PREFIX=/opt/conda/envs/seqsero2s /tmp/patch_stringmlst.sh
73
74 # ============================================================================
75 # Stage 3: Test image - runs validation tests
76 # ============================================================================
77 FROM builder AS test
78
79 # Create test directory
80 WORKDIR /test
81
82 # Run test commands from the conda recipe
83 RUN echo "Running SeqSero2S tests..." && \
84 /opt/conda/envs/seqsero2s/bin/SeqSero2S.py -h && \
85 echo "SeqSero2S.py -h: PASSED" && \
86 /opt/conda/envs/seqsero2s/bin/blastn -help && \
87 echo "blastn -help: PASSED" && \
88 /opt/conda/envs/seqsero2s/bin/SalmID.py -h && \
89 echo "SalmID.py -h: PASSED" && \
90 /opt/conda/envs/seqsero2s/bin/mlst -h && \
91 echo "mlst -h: PASSED" && \
92 echo "All tests completed successfully!"
93
94 # Default command shows test results
95 CMD ["echo", "All SeqSero2S tests passed successfully!"]
96
97 # ============================================================================
98 # Stage 4: Production/Distribution image - minimal runtime (DEFAULT)
99 # ============================================================================
100 FROM condaforge/mambaforge:latest AS dist
101
102 # Copy conda environment from builder
103 COPY --from=builder /opt/conda/envs/seqsero2s /opt/conda/envs/seqsero2s
104
105 # Update PATH to use the conda environment
106 ENV PATH=/opt/conda/envs/seqsero2s/bin:$PATH \
107 CONDA_DEFAULT_ENV=seqsero2s \
108 CONDA_PREFIX=/opt/conda/envs/seqsero2s
109
110 # Install minimal runtime dependencies
111 RUN apt-get update && \
112 apt-get install -y --no-install-recommends \
113 ca-certificates \
114 procps \
115 && apt-get clean && \
116 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
117
118 # Create working directory
119 WORKDIR /data
120
121 # Create non-root user for running the application
122 RUN useradd -m -u 1000 -s /bin/bash seqsero2s && \
123 chown -R seqsero2s:seqsero2s /data
124
125 USER seqsero2s
126
127 # Add metadata labels
128 LABEL org.opencontainers.image.version="1.1.4" \
129 org.opencontainers.image.authors="LSTUGA" \
130 org.opencontainers.image.url="https://github.com/LSTUGA/SeqSero2S" \
131 org.opencontainers.image.documentation="https://github.com/LSTUGA/SeqSero2S" \
132 org.opencontainers.image.source="https://github.com/LSTUGA/SeqSero2S" \
133 org.opencontainers.image.licenses="GPL-2.0-or-later" \
134 org.opencontainers.image.title="SeqSero2S" \
135 org.opencontainers.image.description="Simplified Salmonella serotype prediction from genome sequencing data"
136
137 # No entrypoint or command for dist target