Skip to content

Commit c027876

Browse files
committed
Extend nextstrain/base with mamba
1 parent 6f92b0c commit c027876

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

Dockerfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
# Stage 1: Create conda environment
2-
FROM mambaorg/micromamba:2.0.8 AS conda-builder
3-
4-
COPY --chown=$MAMBA_USER:$MAMBA_USER env.yaml /tmp/env.yaml
5-
RUN micromamba create -y -n env -f /tmp/env.yaml && \
6-
micromamba clean --all --yes
7-
8-
# Stage 2: Build final image extending nextstrain/base
91
FROM nextstrain/base:latest
102

11-
# Copy the conda environment from the previous stage
12-
COPY --from=conda-builder /opt/conda/envs/env /opt/conda/envs/env
3+
# Install micromamba and set up conda directory
4+
RUN curl -L micro.mamba.pm/install.sh | bash && \
5+
ln -s micromamba /nextstrain/.local/bin/mamba && \
6+
mkdir -p /opt/conda && \
7+
chown nextstrain:nextstrain /opt/conda
8+
ENV MAMBA_EXE=/nextstrain/.local/bin/micromamba
9+
ENV MAMBA_ROOT_PREFIX=/opt/conda
1310

14-
# Add environment bin to PATH
15-
# Notes:
16-
# 1. This makes the conda-installed tools available but isn't equivalent to
17-
# activating the environment since micromamba itself is not part of the final
18-
# image.
19-
# 2. nextstrain/base puts programs in /usr/local/bin, and those should take
20-
# precedence.
21-
ENV PATH="/usr/local/bin:/opt/conda/envs/env/bin:$PATH"
11+
# Make mamba/micromamba available in PATH
12+
ENV PATH="/nextstrain/.local/bin:$MAMBA_ROOT_PREFIX/bin:$PATH"

0 commit comments

Comments
 (0)