-
Notifications
You must be signed in to change notification settings - Fork 30
79 lines (71 loc) · 2.47 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: docker
on:
# Temporary - change back to schedule once it is confirmed to work
pull_request:
# schedule:
# - cron: '30 18 * * *'
env:
CERBERUS_IMAGE_ID: ghcr.io/rems-project/cerberus/cn:release
# Cancelling an in-progress job when a new push is performed causes the CI to
# show up as failed: https://github.com/orgs/community/discussions/8336
# This is noisy. If we want to enable that, we should consider:
# https://github.com/MercuryTechnologies/delete-cancelled-runs
concurrency:
group: docker-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy-docker:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux-amd64, linux-arm64]
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
run: |
echo "Building ${{env.CERBERUS_IMAGE_ID}}"
PLATFORM=${{ matrix.platform }} make -f Makefile_docker release_cn
docker tag cn:release ${{env.CERBERUS_IMAGE_ID}}-${{ matrix.platform }}
- name: Push the Docker image
run: docker push ${{env.CERBERUS_IMAGE_ID}}-${{ matrix.platform }}
combine-docker:
runs-on: docker:latest
needs: deploy-docker
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull images
run: |
docker pull ${{env.CERBERUS_IMAGE_ID}}-linux-amd64
docker pull ${{env.CERBERUS_IMAGE_ID}}-linux-arm64
- name: Create manifest
run: |
docker manifest create ${{env.CERBERUS_IMAGE_ID}} ${{env.CERBERUS_IMAGE_ID}}-linux-amd64 ${{env.CERBERUS_IMAGE_ID}}-linux-arm64
docker manifest inspect ${{env.CERBERUS_IMAGE_ID}}
- name: Push the Docker image
run: docker manifest push ${{env.CERBERUS_IMAGE_ID}}