Skip to content

Commit

Permalink
Added build arguments for Dockerfile
Browse files Browse the repository at this point in the history
Updated Docker build-and-push to v6
  • Loading branch information
ssun30 committed Oct 26, 2024
1 parent 9c1f0ac commit 70fa4f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,18 +406,12 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
push: true
tags: reactionmechanismgenerator/rmg:latest

build-and-push-docker-echem:
# after testing and on pushes to main, build and push docker image
# technically we could live without the 'needs' since _in theory_
# nothing will ever be merged into main that fails the tests, but
# who knows ¯\_(ツ)_/¯
#
# taken from https://github.com/docker/build-push-action
needs: build-and-test-linux
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/echem-rebase' && github.repository == 'ReactionMechanismGenerator/RMG-Py'
Expand All @@ -435,7 +429,11 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v6
with:
push: true
tags: reactionmechanismgenerator/rmg:electrocat
build-args: |
RMG_Py_Branch=echem-rebase
RMG_Database_Branch=lithium_rebase
RMS_Branch=marcus_development
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ RUN apt-get update && \
apt-get clean -y

# Install conda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash Miniconda3-latest-Linux-x86_64.sh -b -p /miniconda && \
rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH="$PATH:/miniconda/bin"
RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh" && \
bash Miniforge3-Linux-x86_64.sh -b -p /miniforge && \
rm Miniforge3-Linux-x86_64.sh
ENV PATH="$PATH:/miniforge/bin"

# Set solver backend to mamba for speed
RUN conda install -n base conda-libmamba-solver && \
Expand All @@ -35,12 +35,18 @@ RUN conda install -n base conda-libmamba-solver && \
# Set Bash as the default shell for following commands
SHELL ["/bin/bash", "-c"]

# Add build arguments for RMG-Py, RMG-database, and RMS branches.
ARG RMG_Py_Branch=main
ARG RMG_Database_Branch=main
ARG RMS_Branch=main
ENV rmsbranch=${RMS_Branch}

# cd
WORKDIR /rmg

# Clone the RMG base and database repositories
RUN git clone --single-branch --branch main --depth 1 https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
git clone --single-branch --branch main --depth 1 https://github.com/ReactionMechanismGenerator/RMG-database.git
RUN git clone --single-branch --branch ${RMG_Py_Branch} --depth 1 https://github.com/ReactionMechanismGenerator/RMG-Py.git && \
git clone --single-branch --branch ${RMG_Database_Branch} --depth 1 https://github.com/ReactionMechanismGenerator/RMG-database.git

WORKDIR /rmg/RMG-Py
# build the conda environment
Expand All @@ -64,7 +70,7 @@ ENV PATH="$RUNNER_CWD/RMG-Py:$PATH"
# setting this env variable fixes an issue with Julia precompilation on Windows
ENV JULIA_CPU_TARGET="x86-64,haswell,skylake,broadwell,znver1,znver2,znver3,cascadelake,icelake-client,cooperlake,generic"
RUN make && \
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master")); Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev="main")); using ReactionMechanismSimulator' && \
julia -e 'using Pkg; Pkg.add(PackageSpec(name="PyCall",rev="master")); Pkg.add(PackageSpec(name="ReactionMechanismSimulator",rev=ENV["rmsbranch"])); using ReactionMechanismSimulator' && \
python -c "import julia; julia.install(); import diffeqpy; diffeqpy.install()"

# RMG-Py should now be installed and ready - trigger precompilation and test run
Expand Down

0 comments on commit 70fa4f4

Please sign in to comment.