| 1 |
# 1) The Mamba image |
| 2 |
# This image has mamba installed, we use it to create and pack |
| 3 |
# the required Conda environment. |
| 4 |
FROM mambaorg/micromamba AS mamba |
| 5 |
|
| 6 |
# create the environment |
| 7 |
COPY conda-environment.yml . |
| 8 |
RUN micromamba env create -f conda-environment.yml --prefix ./env |
| 9 |
|
| 10 |
# pack the environment |
| 11 |
RUN \ |
| 12 |
micromamba create -c conda-forge -n conda-pack conda-pack && \ |
| 13 |
micromamba run -n conda-pack conda-pack --prefix ./env -o ./packed-env.tar && \ |
| 14 |
pwd && \ |
| 15 |
mkdir ./venv && \ |
| 16 |
cd ./venv && \ |
| 17 |
tar -xf ../packed-env.tar && \ |
| 18 |
rm ../packed-env.tar |
| 19 |
|
| 20 |
|
| 21 |
# 2) The Cylc image |
| 22 |
# This has the Cylc Mamba environment installed and activated by default in |
| 23 |
# Bash shells. However, it does not have Mamba installed. |
| 24 |
FROM ubuntu:latest AS cylc-dev |
| 25 |
|
| 26 |
COPY --from=mamba /tmp/venv /venv |
| 27 |
COPY ./ /cylc |
| 28 |
|
| 29 |
SHELL ["/bin/bash", "-c", "-l"] |
| 30 |
ENTRYPOINT /bin/bash |
| 31 |
|
| 32 |
# wipe the default crud then auto-activate the Cylc Mamba environment |
| 33 |
RUN \ |
| 34 |
rm $HOME/.bashrc && \ |
| 35 |
echo '. /venv/bin/activate' >> $HOME/.bashrc && \ |
| 36 |
echo "export TMPDIR=/tmp" >> $HOME/.bashrc |
| 37 |
|
| 38 |
# unpack the Mamba environment, then install Cylc into it from source |
| 39 |
RUN \ |
| 40 |
/venv/bin/conda-unpack && \ |
| 41 |
pip install --no-deps -e /cylc coverage && \ |
| 42 |
pip cache purge && \ |
| 43 |
cylc version --long |
| 44 |
|
| 45 |
# install system dependencies |
| 46 |
RUN \ |
| 47 |
apt-get update && \ |
| 48 |
apt-get -qq -y install procps rsync tree at && \ |
| 49 |
apt-get autoclean |