Spaces:
Build error
Build error
Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192FROM ubuntu:24.04ARG DEBIAN_FRONTEND=noninteractiveARG MICROMAMBA_VERSION=2.8.1-0ARG TARGETARCHENV LANG=C.UTF-8 \LC_ALL=C.UTF-8 \MAMBA_ROOT_PREFIX=/opt/micromamba \PYTHONUNBUFFERED=1 \PIP_NO_CACHE_DIR=1 \STREAMLIT_SERVER_PORT=7860 \STREAMLIT_SERVER_ADDRESS=0.0.0.0USER rootRUN apt-get update && apt-get install -y --no-install-recommends \ca-certificates curl bzip2 xz-utils gzip unzip zip git wget tini \build-essential procps libgomp1 libcurl4-openssl-dev libssl-dev \&& rm -rf /var/lib/apt/lists/*# Micromamba is used to isolate groups of bioinformatics tools whose Python# dependencies would otherwise conflict in one monolithic environment.RUN case "${TARGETARCH:-amd64}" in \amd64) MM_ARCH=64 ;; \arm64) MM_ARCH=aarch64 ;; \*) MM_ARCH=64 ;; \esac && \curl -fsSL "https://github.com/mamba-org/micromamba-releases/releases/download/${MICROMAMBA_VERSION}/micromamba-linux-${MM_ARCH}" \-o /usr/local/bin/micromamba && chmod +x /usr/local/bin/micromambaRUN micromamba config prepend channels conda-forge && \micromamba config append channels bioconda && \micromamba config set channel_priority flexible# Web application environment.RUN micromamba create -y -n app python=3.11 pip && micromamba clean --all --yes# --- Core WGS environment: read QC, assembly, polishing, distance/taxonomy, ---# --- alignment/tree tools. One or two packages per layer to bound memory. ---# --- First layer per env uses `create`; every later layer for the SAME env ---# --- must use `install`, since `create -n <existing name>` wipes and ---# --- recreates the environment instead of adding to it. ---RUN micromamba create -y -n core python=3.9 fastp fastqc && micromamba clean --all --yesRUN micromamba install -y -n core multiqc && micromamba clean --all --yesRUN micromamba install -y -n core spades && micromamba clean --all --yesRUN micromamba create -y -n quast python=3.10 quast && micromamba clean --all --yesRUN micromamba install -y -n core flye && micromamba clean --all --yesRUN micromamba install -y -n core unicycler && micromamba clean --all --yesRUN micromamba install -y -n core polypolish bwa samtools minimap2 && micromamba clean --all --yesRUN micromamba install -y -n core mash skani && micromamba clean --all --yesRUN micromamba install -y -n core mafft iqtree && micromamba clean --all --yesRUN micromamba install -y -n core blast minced && micromamba clean --all --yes# --- Surveillance / typing environment. No annotation-dependent tools. ---RUN micromamba create -y -n surveillance python=3.10 mlst && micromamba clean --all --yesRUN micromamba install -y -n surveillance snippy && micromamba clean --all --yesRUN micromamba install -y -n surveillance gubbins && micromamba clean --all --yes# --- Database-dependent tools, isolated and split one per layer. Reference ---# --- databases themselves are NOT baked into the image; mount under /data. ---RUN micromamba create -y -n taxonomy python=3.10 gtdbtk && micromamba clean --all --yesRUN micromamba create -y -n checkm2 -c conda-forge -c bioconda python=3.12 checkm2 && micromamba clean --all --yesRUN micromamba create -y -n functional python=3.10 genomad && micromamba clean --all --yesRUN micromamba install -y -n functional mob_suite && micromamba clean --all --yesRUN micromamba install -y -n functional integron_finder && micromamba clean --all --yesRUN micromamba create -y -n epidemiology python=3.10 chewbbaca && micromamba clean --all --yesRUN micromamba install -y -n epidemiology poppunk && micromamba clean --all --yesENV PATH=/opt/micromamba/envs/core/bin:/opt/micromamba/envs/quast/bin:/opt/micromamba/envs/surveillance/bin:/opt/micromamba/envs/taxonomy/bin:/opt/micromamba/envs/checkm2/bin:/opt/micromamba/envs/functional/bin:/opt/micromamba/envs/epidemiology/bin:/opt/micromamba/envs/app/bin:$PATH# Hugging Face Docker Spaces expect the runtime user to be UID 1000.# ubuntu:24.04 already ships a default user at UID 1000, so remove it first# rather than colliding with useradd.RUN existing_user="$(getent passwd 1000 | cut -d: -f1 || true)"; \if [ -n "$existing_user" ] && [ "$existing_user" != "appuser" ]; then \userdel -r "$existing_user" 2>/dev/null || userdel "$existing_user"; \fi && \useradd -m -u 1000 -s /bin/bash appuser && \mkdir -p /app /data /home/appuser/.streamlit /home/appuser/.cache && \chown -R 1000:1000 /app /data /home/appuserWORKDIR /appCOPY --chown=1000:1000 requirements.txt /app/requirements.txtRUN /opt/micromamba/envs/app/bin/python -m pip install --no-cache-dir -r /app/requirements.txtCOPY --chown=1000:1000 . /appENV HOME=/home/appuser XDG_CACHE_HOME=/home/appuser/.cacheUSER 1000EXPOSE 7860ENTRYPOINT ["/usr/bin/tini", "--"]CMD ["/opt/micromamba/envs/app/bin/streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]12345678910111213141516171819202122232425262728293031323334353637383940414243444546FROM python:3.11-slimWORKDIR /appENV PYTHONUNBUFFERED=1 \PIP_NO_CACHE_DIR=1# System tools. cd-hit comes from apt; drop it if only prokka needed it.RUN apt-get update && apt-get install -y --no-install-recommends \build-essential \gcc \g++ \wget \cd-hit \&& rm -rf /var/lib/apt/lists/*# Miniforge, used only to host the bioinformatics stackRUN wget -q "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" \-O /tmp/miniforge.sh \&& bash /tmp/miniforge.sh -b -p /opt/conda \&& rm /tmp/miniforge.sh# prokka in its own environment, so its perl and python pins never touch the appRUN /opt/conda/bin/mamba create -y -n prokka -c conda-forge -c bioconda prokka \&& /opt/conda/bin/conda clean -afy# Appended, not prepended: /usr/local/bin python 3.11 stays first on PATHENV PATH="${PATH}:/opt/conda/envs/prokka/bin"# Fail here, loudly, if the PATH arrangement is wrongRUN prokka --version && which blastp aragorn barrnap prodigal tbl2asnCOPY requirements.txt /app/requirements.txt# --only-binary=:all: turns a silent source build into an immediate readable errorRUN python -m pip install --upgrade pip \&& python -m pip install --only-binary=:all: -r /app/requirements.txtCOPY . /appEXPOSE 8501HEALTHCHECK --interval=30s --timeout=5s --start-period=30s \CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8501/_stcore/health')"CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
Dockerfile+31-77