-
Notifications
You must be signed in to change notification settings - Fork 8
51 lines (42 loc) · 1.77 KB
/
multi-arch-sample.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
name: multi-arch image sample
on:
push:
workflow_dispatch:
env:
GITHUB_USERNAME: baronfel
APP_NAME: multi-arch-sample
jobs:
create-multiarch-image:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get the code
uses: actions/checkout@v4
- name: Get .NET
uses: actions/setup-dotnet@v4
- name: build the x64 image
id: build-x64
working-directory: src/multi-arch-sample
run: |
dotnet publish -t:PublishContainer --arch x64 -p ContainerImageTag=latest-x64 -p ContainerRepository=${{github.repository_owner}}/${{env.APP_NAME}} -p ContainerRegistry=ghcr.io /check
echo "generated_container_name=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest-x64" >> $GITHUB_OUTPUT
- name: build the arm64 image
id: build-arm64
working-directory: src/multi-arch-sample
run: |
dotnet publish -t:PublishContainer --arch arm64 -p ContainerImageTag=latest-arm64 -p ContainerRepository=${{github.repository_owner}}/${{env.APP_NAME}} -p ContainerRegistry=ghcr.io /check
echo "generated_container_name=ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest-arm64" >> $GITHUB_OUTPUT
- name: create the multi-image manifest
run: |
docker manifest create ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest \
${{ steps.build-x64.outputs.generated_container_name }} \
${{ steps.build-arm64.outputs.generated_container_name }} \
docker manifest push ghcr.io/${{github.repository_owner}}/${{env.APP_NAME}}:latest