Merge pull request #27 from Becksteinlab/update-lammps-branch #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
name: Create and publish a Docker image | |
# Configures this workflow to run every time a change is pushed to the branch called `release`. | |
on: | |
push: | |
branches: ['main'] | |
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | |
jobs: | |
build-common-image: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: [amd64] | |
build: ["common-cpu", "common-gpu"] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Free disk space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Option | |
id: option | |
run: | | |
if [ "${{ matrix.build }}" == "common-cpu" ]; then | |
echo GMX_OPTS= >> $GITHUB_ENV | |
echo LMP_OPTS= >> $GITHUB_ENV | |
echo NAMD_OPTS= >> $GITHUB_ENV | |
echo DOCKERFILE="CPU.Dockerfile" >> $GITHUB_ENV | |
else | |
echo GMX_OPTS="-DGMX_GPU=CUDA" >> $GITHUB_ENV | |
echo LMP_OPTS="-DPKG_GPU=on -DGPU_API=cuda" >> $GITHUB_ENV | |
echo NAMD_OPTS="--with-cuda" >> $GITHUB_ENV | |
echo DOCKERFILE="GPU.Dockerfile" >> $GITHUB_ENV | |
fi | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./docker/common | |
file: ./docker/common/${{ env.DOCKERFILE }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.build }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
GMX_OPTS="${{ env.GMX_OPTS }}" | |
LMP_OPTS="${{ env.LMP_OPTS }}" | |
CUDA_VER=12.4.1 | |
DISTRO_ARCH=${{ matrix.arch }} | |
DISTRO_VER=22.04 | |
DISTRO_NAME=ubuntu | |
- name: Build and push private NAMD Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./docker/namd | |
file: ./docker/namd/${{ env.DOCKERFILE }} | |
push: true | |
tags: ghcr.io/becksteinlab/streaming-namd-docker:main-${{ matrix.build }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
NAMD_OPTS="${{ env.NAMD_OPTS }}" | |
CUDA_VER=12.4.1 | |
DISTRO_ARCH=${{ matrix.arch }} | |
DISTRO_VER=22.04 | |
DISTRO_NAME=ubuntu | |
secrets: | | |
NAMD_ACCESS_TOKEN=${{ secrets.NAMD_ACCESS_TOKEN }} |