Spaces:
Build error
Build error
Download Dockerfile from GENOMICS-CDDBRG/Genome_Comparative_Analysis: direct link, hf CLI and curl.
- Browser
- Download file 6.39 kB
-
https://huggingface.co/spaces/GENOMICS-CDDBRG/Genome_Comparative_Analysis/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/GENOMICS-CDDBRG/Genome_Comparative_Analysis/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/GENOMICS-CDDBRG/Genome_Comparative_Analysis/resolve/main/Dockerfile
6.39 kB
| # WOLOJI Comprehensive Bacterial Genomics Suite: one Dockerfile for Hugging Face Spaces and local use. | |
| # | |
| # WOLOJI_TOOLSET selects how much of the command-line stack is installed: | |
| # lite BLAST+, MAFFT, IQ-TREE 2 and Primer3 only (utilities tab; pipeline runs in dry-run mode) | |
| # standard lite + read QC, assembly, polishing, QUAST, Mash, skani, MLST, MinCED, | |
| # MOB-suite, IntegronFinder, Snippy and Gubbins (default) | |
| # full standard + geNomad, chewBBACA, PopPUNK, CheckM2 and GTDB-Tk | |
| # Local build example: docker build --build-arg WOLOJI_TOOLSET=full -t woloji . | |
| # On Hugging Face, change the default value on the ARG line below. | |
| # | |
| # Reference databases are NOT downloaded here. Mount them (for example under /data) | |
| # and set GTDBTK_DATA_PATH, CHECKM2DB, GENOMAD_DB and MOB_SUITE_DB. | |
| FROM python:3.11-slim-bookworm | |
| ARG WOLOJI_TOOLSET=standard | |
| ARG DEBIAN_FRONTEND=noninteractive | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| MAMBA_ROOT_PREFIX=/opt/micromamba \ | |
| WOLOJI_TOOLSET=${WOLOJI_TOOLSET} | |
| # --------------------------------------------------------------------------- | |
| # 1. System packages and the utility tools used by the "sequence utilities" tab. | |
| # Debian's iqtree package provides the iqtree2 executable that app.py calls. | |
| # --------------------------------------------------------------------------- | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ca-certificates curl bzip2 procps tini \ | |
| ncbi-blast+ mafft iqtree primer3 \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && blastn -version && mafft --version && iqtree2 --version | head -n 1 | |
| # --------------------------------------------------------------------------- | |
| # 2. Bioinformatics pipeline tools from bioconda. | |
| # Each group lives in its own environment under /opt/envs, so their pins never | |
| # clash with each other or with the app's Python. Small wrapper scripts in | |
| # /opt/woloji/bin put the right environment first on PATH before starting a | |
| # tool (this matters for Perl and Python tools such as Snippy and mlst). | |
| # The wrapper folder is appended to PATH, so the app's Python 3.11 stays first. | |
| # --------------------------------------------------------------------------- | |
| RUN set -eu; \ | |
| mkdir -p /opt/woloji/bin /opt/envs "$MAMBA_ROOT_PREFIX"; \ | |
| if [ "$WOLOJI_TOOLSET" = "lite" ]; then echo "Toolset lite: skipping conda tools"; exit 0; fi; \ | |
| case "$WOLOJI_TOOLSET" in standard|full) ;; *) echo "Unknown WOLOJI_TOOLSET: $WOLOJI_TOOLSET" >&2; exit 1 ;; esac; \ | |
| curl -fsSL https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64 \ | |
| -o /usr/local/bin/micromamba; \ | |
| chmod 755 /usr/local/bin/micromamba; \ | |
| printf 'channels:\n - conda-forge\n - bioconda\nchannel_priority: strict\n' > /root/.mambarc; \ | |
| mkenv() { \ | |
| env="$1"; specs="$2"; exes="$3"; \ | |
| echo ">>> creating environment $env: $specs"; \ | |
| micromamba create -y -q -p "/opt/envs/$env" $specs; \ | |
| for exe in $exes; do \ | |
| test -x "/opt/envs/$env/bin/$exe" || { echo "Missing $exe in environment $env" >&2; exit 1; }; \ | |
| printf '#!/bin/sh\nexport CONDA_PREFIX="/opt/envs/%s"\nexport PATH="/opt/envs/%s/bin:$PATH"\nexec "/opt/envs/%s/bin/%s" "$@"\n' \ | |
| "$env" "$env" "$env" "$exe" > "/opt/woloji/bin/$exe"; \ | |
| chmod 755 "/opt/woloji/bin/$exe"; \ | |
| done; \ | |
| micromamba clean -a -y -q; \ | |
| }; \ | |
| mkenv readqc "fastp fastqc multiqc" "fastp fastqc multiqc"; \ | |
| mkenv assembly "spades unicycler>=0.5 bwa polypolish>=0.6" "spades.py unicycler bwa polypolish"; \ | |
| mkenv flye "flye" "flye"; \ | |
| mkenv quast "quast" "quast.py"; \ | |
| mkenv typing "mash skani mlst minced" "mash skani mlst minced"; \ | |
| mkenv mobsuite "mob_suite>=3.1" "mob_recon mob_typer"; \ | |
| mkenv integron "integron_finder>=2" "integron_finder"; \ | |
| mkenv snippy "snippy>=4.6" "snippy snippy-core"; \ | |
| mkenv gubbins "gubbins>=3.3" "run_gubbins.py"; \ | |
| if [ "$WOLOJI_TOOLSET" = "full" ]; then \ | |
| mkenv genomad "genomad" "genomad"; \ | |
| mkenv chewbbaca "chewbbaca>=3" "chewBBACA.py"; \ | |
| mkenv poppunk "poppunk" "poppunk"; \ | |
| mkenv checkm2 "checkm2" "checkm2"; \ | |
| mkenv gtdbtk "gtdbtk>=2.3" "gtdbtk"; \ | |
| fi; \ | |
| for d in /opt/envs/mobsuite/lib/python3*/site-packages/mob_suite/databases; do \ | |
| if [ -d "$d" ]; then chown -R 1000:1000 "$d"; fi; \ | |
| done; \ | |
| rm -rf /root/.cache /tmp/* | |
| ENV PATH="${PATH}:/opt/woloji/bin" | |
| # --------------------------------------------------------------------------- | |
| # 3. Non-root user required by Hugging Face Spaces (UID 1000) and the app itself. | |
| # --------------------------------------------------------------------------- | |
| RUN useradd -m -u 1000 -s /bin/bash user | |
| ENV HOME=/home/user | |
| WORKDIR /home/user/app | |
| COPY --chown=1000:1000 requirements.txt ./ | |
| RUN python -m pip install --upgrade pip \ | |
| && python -m pip install --only-binary=:all: -r requirements.txt | |
| COPY --chown=1000:1000 app.py README.md ./ | |
| USER 1000 | |
| # Streamlit settings. XSRF and CORS protection are disabled because Hugging Face serves | |
| # the app inside an iframe, where they block file uploads. Keep them enabled if you | |
| # expose the container directly on a network. | |
| ENV STREAMLIT_SERVER_PORT=7860 \ | |
| STREAMLIT_SERVER_ADDRESS=0.0.0.0 \ | |
| STREAMLIT_SERVER_HEADLESS=true \ | |
| STREAMLIT_SERVER_MAX_UPLOAD_SIZE=2048 \ | |
| STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false \ | |
| STREAMLIT_SERVER_ENABLE_CORS=false \ | |
| STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=60s \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/_stcore/health')" | |
| ENTRYPOINT ["/usr/bin/tini", "--"] | |
| CMD ["streamlit", "run", "app.py"] | |