2
2
- push
3
3
- workflow_dispatch
4
4
jobs :
5
- build :
5
+ build-amd64 :
6
6
runs-on : ubuntu-latest-64-cores
7
7
steps :
8
- - name : Set up QEMU
9
- uses : docker/setup-qemu-action@v2
10
-
11
8
- name : Set up Docker Buildx
12
- uses : docker/setup-buildx-action@v2
9
+ uses : docker/setup-buildx-action@v3
13
10
14
11
- name : Log into Docker Hub
15
- uses : docker/login-action@v2
12
+ uses : docker/login-action@v3
16
13
with :
17
14
username : ${{ secrets.DOCKERHUB_USERNAME }}
18
15
password : ${{ secrets.DOCKERHUB_TOKEN }}
19
16
20
17
- name : Setup Python
21
18
uses : actions/setup-python@v5
22
19
with :
23
- python-version : ' 3.11 '
20
+ python-version : ' 3.12 '
24
21
25
22
- name : Build for linux/amd64
26
- uses : docker/build-push-action@v3
23
+ uses : docker/build-push-action@v5
27
24
with :
28
25
build-args : |
29
26
VCS_REF=${{ github.sha }}
27
+ BUILDARCH=amd64
30
28
load : true
31
29
platforms : linux/amd64
32
- tags : cs50/server:amd64
30
+ tags : |
31
+ cs50/server:amd64
32
+ cs50/server:canary-amd64
33
33
cache-from : type=registry,ref=cs50/server:amd64-buildcache
34
34
cache-to : type=registry,ref=cs50/server:amd64-buildcache,mode=max
35
35
@@ -43,31 +43,93 @@ jobs:
43
43
run : |
44
44
docker push cs50/server:amd64
45
45
46
+ - name : Push linux/amd64 build to Docker Hub (canary)
47
+ run : |
48
+ docker push cs50/server:canary-amd64
49
+
50
+ build-arm64 :
51
+ runs-on : ubuntu-latest-64-cores-arm
52
+ steps :
53
+ - name : Install Docker (remove once Docker is pre-installed on arm64 runners)
54
+ run : |
55
+ export DEBIAN_FRONTEND=noninteractive
56
+ sudo apt update
57
+ sudo apt install -y ca-certificates curl
58
+ sudo install -m 0755 -d /etc/apt/keyrings
59
+ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
60
+ sudo chmod a+r /etc/apt/keyrings/docker.asc
61
+ echo \
62
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
63
+ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
64
+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
65
+ sudo apt update
66
+ sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
67
+ sudo usermod -aG docker $USER
68
+ sudo apt install -y acl
69
+ sudo setfacl --modify user:$USER:rw /var/run/docker.sock
70
+
71
+ - name : Set up Docker Buildx
72
+ uses : docker/setup-buildx-action@v3
73
+
74
+ - name : Log into Docker Hub
75
+ uses : docker/login-action@v3
76
+ with :
77
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
78
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
79
+
80
+ - name : Install Python (replace with setup-python once available on arm64 runners)
81
+ run : |
82
+ sudo apt install -y python3 python3-pip
83
+
46
84
- name : Build for linux/arm64
47
- uses : docker/build-push-action@v3
85
+ uses : docker/build-push-action@v5
48
86
with :
49
87
build-args : |
50
88
VCS_REF=${{ github.sha }}
89
+ BUILDARCH=arm64
51
90
load : true
52
91
platforms : linux/arm64
53
- tags : cs50/server:arm64
92
+ tags : |
93
+ cs50/server:arm64
94
+ cs50/server:canary-arm64
54
95
cache-from : type=registry,ref=cs50/server:arm64-buildcache
55
96
cache-to : type=registry,ref=cs50/server:arm64-buildcache,mode=max
56
97
57
98
- name : Squash for linux/arm64
58
99
run : |
59
100
pip3 install docker-squash
60
- docker-squash --tag cs50/server:arm64 cs50/server:arm64
101
+ $HOME/.local/bin/ docker-squash --tag cs50/server:arm64 cs50/server:arm64
61
102
62
103
- name : Push linux/arm64 build to Docker Hub
63
104
if : ${{ github.ref == 'refs/heads/main' }}
64
105
run : |
65
106
docker push cs50/server:arm64
66
107
108
+ - name : Push linux/arm64 build to Docker Hub (canary)
109
+ run : |
110
+ docker push cs50/server:canary-arm64
111
+
112
+ finalize :
113
+ needs : [build-amd64, build-arm64]
114
+ runs-on : ubuntu-latest
115
+ steps :
116
+ - name : Log into Docker Hub
117
+ uses : docker/login-action@v3
118
+ with :
119
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
120
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
121
+
67
122
- name : Create multi-arch manifest and push to Docker Hub
68
123
if : ${{ github.ref == 'refs/heads/main' }}
69
124
run : |
70
125
docker manifest create cs50/server:latest \
71
126
--amend cs50/server:amd64 \
72
127
--amend cs50/server:arm64
73
128
docker manifest push cs50/server:latest
129
+
130
+ - name : Create multi-arch manifest and push to Docker Hub (canary)
131
+ run : |
132
+ docker manifest create cs50/server:canary \
133
+ --amend cs50/server:canary-amd64 \
134
+ --amend cs50/server:canary-arm64
135
+ docker manifest push cs50/server:canary
0 commit comments