Skip to content

Commit 33eb607

Browse files
Use Github's Container Registry (GHCR) to save environment image
1 parent 6c7b1b6 commit 33eb607

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

.github/docker-compose.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,17 @@ services:
1919
- .github/:/configs
2020

2121
env:
22-
image: "local/env"
22+
image: "ghcr.io/sandialabs/fenix/env"
2323
build:
24-
# Generated by spack in a previous workflow step
24+
# Generated by running the bootstrap image
2525
dockerfile: .github/spack.Dockerfile
26-
depends_on:
27-
bootstrap:
28-
condition: service_completed_successfully
29-
required: true
30-
pull_policy: build
31-
3226

3327
fenix:
3428
image: "local/fenix"
3529
build:
3630
dockerfile_inline: |
37-
FROM local/env
31+
ARG OMPI_VERSION
32+
FROM ghcr.io/sandialabs/fenix/env:$${OMPI_VERSION}
3833
COPY . /fenix
3934
RUN . /opt/spack-environment/activate.sh && \
4035
mkdir -p /fenix/build && \
@@ -51,4 +46,6 @@ services:
5146
WORKDIR /fenix/build
5247
ENTRYPOINT ["/entrypoint.sh"]
5348
CMD ["ctest", "--output-on-failure"]
49+
args:
50+
OMPI_VERSION: main
5451
pull_policy: build

.github/workflows/ci_checks.yaml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,36 @@ on:
1111
jobs:
1212
test:
1313
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
ompi_version:
17+
- main
18+
1419
steps:
1520
- name: Checkout repository
1621
uses: actions/checkout@v3
1722

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

26+
- name: Log in to GHCR container registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
2133
- name: Bake the bootstrap docker image
2234
uses: docker/bake-action@v5
2335
with:
2436
files: .github/docker-compose.yml
2537
targets: bootstrap
2638
workdir: .
2739
set: |
28-
*.output=type=docker,name=local/bootstrap
29-
*.cache-from=type=gha,scope=local/bootstrap
40+
*.output=type=docker,name=local/bootstrap/${{ matrix.ompi_version }}
41+
*.cache-from=type=gha,scope=local/bootstrap/${{ matrix.ompi_version }}
3042
*.cache-to=type=gha,mode=max,scope=local/bootstrap
43+
*.args.OMPI_VERSION=${{ matrix.ompi_version }}
3144
3245
- name: Bootstrap the environment Dockerfile
3346
run: docker run -v ${GITHUB_WORKSPACE}/.github:/configs local/bootstrap
@@ -36,23 +49,24 @@ jobs:
3649
uses: docker/bake-action@v5
3750
with:
3851
files: .github/docker-compose.yml
39-
targets: env
52+
targets: ghcr.io/sandialabs/fenix/env
4053
workdir: .
54+
pull: true
55+
push: true
4156
set: |
42-
*.output=type=docker,name=local/env
43-
*.cache-from=type=gha,scope=local/env
44-
*.cache-to=type=gha,mode=max,scope=local/env
57+
*.cache-from=type=gha,scope=local/env/${{ matrix.ompi_version }}
58+
*.cache-to=type=gha,mode=max,scope=local/env/${{ matrix.ompi_version }}
59+
*.tags=ghcr.io/sandialabs/fenix/env:${{ matrix.ompi_version }}
4560
4661
- name: Build Fenix
4762
uses: docker/bake-action@v5
4863
with:
4964
source: .
5065
files: .github/docker-compose.yml
51-
targets: env,fenix
66+
targets: fenix
5267
workdir: .
5368
set: |
54-
*.output=type=docker,name=local/fenix
55-
*.cache-from=type=gha,scope=local/env
69+
*.args.OMPI_VERSION=${{ matrix.ompi_version }}
5670
5771
- name: Test Fenix
5872
run: docker run local/fenix

0 commit comments

Comments
 (0)