Skip to content

Commit

Permalink
Use Github's Container Registry (GHCR) to save environment image
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Whitlock committed Nov 13, 2024
1 parent 6c7b1b6 commit 4679c8b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
15 changes: 6 additions & 9 deletions .github/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@ services:
- .github/:/configs

env:
image: "local/env"
image: "ghcr.io/sandialabs/fenix/env"
build:
# Generated by spack in a previous workflow step
# Generated by running the bootstrap image
dockerfile: .github/spack.Dockerfile
depends_on:
bootstrap:
condition: service_completed_successfully
required: true
pull_policy: build


fenix:
image: "local/fenix"
build:
dockerfile_inline: |
FROM local/env
ARG OMPI_VERSION
FROM ghcr.io/sandialabs/fenix/env:$${OMPI_VERSION}
COPY . /fenix
RUN . /opt/spack-environment/activate.sh && \
mkdir -p /fenix/build && \
Expand All @@ -51,4 +46,6 @@ services:
WORKDIR /fenix/build
ENTRYPOINT ["/entrypoint.sh"]
CMD ["ctest", "--output-on-failure"]
args:
OMPI_VERSION: main
pull_policy: build
32 changes: 23 additions & 9 deletions .github/workflows/ci_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,36 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ompi_version:
- main

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GHCR container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Bake the bootstrap docker image
uses: docker/bake-action@v5
with:
files: .github/docker-compose.yml
targets: bootstrap
workdir: .
set: |
*.output=type=docker,name=local/bootstrap
*.cache-from=type=gha,scope=local/bootstrap
*.output=type=docker,name=local/bootstrap/${{ matrix.ompi_version }}
*.cache-from=type=gha,scope=local/bootstrap/${{ matrix.ompi_version }}
*.cache-to=type=gha,mode=max,scope=local/bootstrap
*.args.OMPI_VERSION=${{ matrix.ompi_version }}
- name: Bootstrap the environment Dockerfile
run: docker run -v ${GITHUB_WORKSPACE}/.github:/configs local/bootstrap
Expand All @@ -36,23 +49,24 @@ jobs:
uses: docker/bake-action@v5
with:
files: .github/docker-compose.yml
targets: env
targets: ghcr.io/sandialabs/fenix/env
workdir: .
pull: true
push: true
set: |
*.output=type=docker,name=local/env
*.cache-from=type=gha,scope=local/env
*.cache-to=type=gha,mode=max,scope=local/env
*.cache-from=type=gha,scope=local/env/${{ matrix.ompi_version }}
*.cache-to=type=gha,mode=max,scope=local/env/${{ matrix.ompi_version }}
*.tags=ghcr.io/sandialabs/fenix/env:${{ matrix.ompi_version }}
- name: Build Fenix
uses: docker/bake-action@v5
with:
source: .
files: .github/docker-compose.yml
targets: env,fenix
targets: fenix
workdir: .
set: |
*.output=type=docker,name=local/fenix
*.cache-from=type=gha,scope=local/env
*.args.OMPI_VERSION=${{ matrix.ompi_version }}
- name: Test Fenix
run: docker run local/fenix

0 comments on commit 4679c8b

Please sign in to comment.