Skip to content

Commit 69df219

Browse files
committed
Split Dockerfile RUN commands to improve layer caching
Separates environment creation, compilation, and installation steps for RMG-Py and ARC into distinct Docker layers. This allows for better utilization of GitHub Actions caching by preventing the entire environment setup from re-running when only later steps change. Pin 3.9 in RMG solve Export RMS BRANCH pin 3.12 arc_env
1 parent f90482b commit 69df219

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

Dockerfile

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,31 @@ RUN wget -qO- https://install.julialang.org | sh -s -- --yes --default-channel 1
3535

3636
# Switch directory to Code and RMG clone
3737
WORKDIR /home/mambauser/Code
38-
RUN git clone --branch ${RMG_PY_BRANCH} https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
39-
git clone --branch ${RMG_DATABASE_BRANCH} https://github.com/ReactionMechanismGenerator/RMG-database.git && \
40-
git clone --branch ${ARC_BRANCH} https://github.com/ReactionMechanismGenerator/ARC.git
41-
42-
# Create RMG-Py environment
43-
RUN micromamba create -y -n rmg_env -f /home/mambauser/Code/RMG-Py/environment.yml && \
44-
micromamba run -n rmg_env micromamba install -y -c conda-forge pyjuliacall conda && \
45-
micromamba clean --all --yes && \
46-
micromamba run -n rmg_env make -C /home/mambauser/Code/RMG-Py -j"$(nproc)" && \
47-
micromamba run -n rmg_env bash -c "\
38+
RUN git clone --depth 1 --branch ${RMG_PY_BRANCH} https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
39+
git clone --depth 1 --branch ${RMG_DATABASE_BRANCH} https://github.com/ReactionMechanismGenerator/RMG-database.git && \
40+
git clone --depth 1 --branch ${ARC_BRANCH} https://github.com/ReactionMechanismGenerator/ARC.git
41+
42+
# Create RMG-Py environment (split into separate layers for GHA cache)
43+
# Pin python=3.9 to drastically reduce solver search space
44+
RUN micromamba create -y -v -n rmg_env python=3.9 -f /home/mambauser/Code/RMG-Py/environment.yml && \
45+
micromamba run -n rmg_env micromamba install -y -v -c conda-forge pyjuliacall conda && \
46+
micromamba clean --all --yes
47+
48+
RUN micromamba run -n rmg_env make -C /home/mambauser/Code/RMG-Py -j"$(nproc)"
49+
50+
RUN micromamba run -n rmg_env bash -c "\
4851
cd /home/mambauser/Code/RMG-Py && \
52+
export RMS_INSTALLER=continuous && \
53+
export RMS_BRANCH=for_rmg && \
4954
source install_rms.sh \
5055
"
5156

5257
WORKDIR /home/mambauser/Code/ARC
53-
RUN micromamba create -y -n arc_env -f environment.yml --channel-priority flexible && \
54-
micromamba install -y -n arc_env -c conda-forge pytest && \
55-
micromamba clean --all -f -y && \
56-
micromamba run -n arc_env bash -euxo pipefail -c \
58+
RUN micromamba create -y -v -n arc_env python=3.12 -f environment.yml && \
59+
micromamba install -y -v -n arc_env -c conda-forge pytest && \
60+
micromamba clean --all -f -y
61+
62+
RUN micromamba run -n arc_env bash -euxo pipefail -c \
5763
"make compile && bash ./devtools/install_pyrdl.sh" && \
5864
micromamba clean --all --yes
5965

0 commit comments

Comments
 (0)