|
1 |
| -FROM mambaorg/micromamba:1.5.8 |
| 1 | +# start with an image with conda installed |
| 2 | +FROM condaforge/mambaforge AS compile-image |
| 3 | + |
| 4 | +WORKDIR /data |
2 | 5 |
|
3 | 6 | COPY . ./fieldbioinformatics/
|
4 | 7 |
|
5 |
| -USER root |
| 8 | +# check for updates |
| 9 | +RUN apt-get update -y && \ |
| 10 | + apt-get upgrade -y && \ |
| 11 | + apt install build-essential -y --no-install-recommends && \ |
| 12 | + apt-get clean && apt-get autoclean |
| 13 | + |
| 14 | +# copy in artic |
| 15 | +RUN cd /data/fieldbioinformatics && \ |
| 16 | + mamba install conda -n base -c conda-forge -c defaults -c bioconda && \ |
| 17 | + mamba env create -f /data/fieldbioinformatics/environment.yml |
| 18 | + |
| 19 | +# Make RUN commands use the new environment: |
| 20 | +SHELL ["conda", "run", "-n", "artic", "/bin/bash", "-c"] |
| 21 | +RUN mamba install -c conda-forge -n artic python=3.9 conda-pack && \ |
| 22 | + cd /data/fieldbioinformatics && \ |
| 23 | + pip install . |
6 | 24 |
|
7 |
| -RUN apt-get update && apt-get install -y --no-install-recommends build-essential wget procps |
| 25 | +# Use conda-pack to create a standalone enviornment |
| 26 | +# in /venv: |
| 27 | +RUN conda list && \ |
| 28 | + conda-pack -n artic -o /tmp/env.tar && \ |
| 29 | + mkdir /venv && cd /venv && tar xf /tmp/env.tar && \ |
| 30 | + rm /tmp/env.tar && /venv/bin/conda-unpack |
8 | 31 |
|
9 |
| -USER $MAMBA_USER |
| 32 | +SHELL ["/bin/bash", "-c"] |
10 | 33 |
|
11 |
| -COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/env.yml |
| 34 | +RUN conda clean --all &&\ |
| 35 | + conda remove --name artic --all |
12 | 36 |
|
13 |
| -RUN sed -i 's/name: artic/name: base/' /tmp/env.yml |
| 37 | +# build artic |
| 38 | +WORKDIR /data/fieldbioinformatics |
| 39 | +RUN source /venv/bin/activate && pip install --user --no-cache-dir . \ |
| 40 | + && pip uninstall -y tensorflow keras pyabpoa \ |
| 41 | + && conda install -y -c conda-forge tensorflow~=2.11 keras~=2.11 |
14 | 42 |
|
15 |
| -RUN micromamba install --yes --file /tmp/env.yml && \ |
16 |
| - micromamba clean --all --yes |
| 43 | +# build image |
| 44 | +FROM debian:bullseye-slim AS runtime-image |
17 | 45 |
|
18 |
| -ARG MAMBA_DOCKERFILE_ACTIVATE=1 |
| 46 | +COPY --from=compile-image /root/.local /root/.local |
| 47 | +ENV PATH=/root/.local/bin:$PATH |
19 | 48 |
|
20 |
| -USER root |
| 49 | +# Copy /venv from the previous stage: |
| 50 | +COPY --from=compile-image /venv /venv |
21 | 51 |
|
22 |
| -RUN python3 -m pip install ./fieldbioinformatics |
| 52 | +# check for updates |
| 53 | +RUN apt-get update -y && \ |
| 54 | + apt-get upgrade -y && \ |
| 55 | + apt install build-essential -y --no-install-recommends && \ |
| 56 | + apt install -y procps && \ |
| 57 | + apt-get clean && apt-get autoclean |
23 | 58 |
|
24 |
| -RUN pip uninstall -y tensorflow keras pyabpoa \ |
25 |
| - && micromamba install -y -c conda-forge -c bioconda tensorflow=2.11 keras=2.11 |
| 59 | +WORKDIR /data |
26 | 60 |
|
27 |
| -USER $MAMBA_USER |
| 61 | +SHELL ["/bin/bash", "-c"] |
28 | 62 |
|
29 |
| -ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"] |
| 63 | +# to allow streamed log output |
| 64 | +ENV PYTHONUNBUFFERED=1 |
| 65 | +ENV PATH=/venv/bin:$PATH |
30 | 66 |
|
31 | 67 | CMD ["/bin/bash"]
|
0 commit comments