Skip to content

Commit a653b53

Browse files
committed
feat: add qemu and separate runners
1 parent 755c7a4 commit a653b53

File tree

1 file changed

+100
-14
lines changed

1 file changed

+100
-14
lines changed

.github/workflows/docker-publish.yml

Lines changed: 100 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,62 @@ env:
1414
IMAGE_NAME: textile/recall-synchronizer
1515

1616
jobs:
17-
build-and-push:
17+
build-amd64:
1818
runs-on: ubuntu-latest
1919
permissions:
2020
contents: read
2121
packages: write
22+
outputs:
23+
image-digest: ${{ steps.build.outputs.digest }}
24+
metadata: ${{ steps.meta.outputs.json }}
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
# - name: Log in to Docker Hub
34+
# if: github.event_name != 'pull_request'
35+
# uses: docker/login-action@v3
36+
# with:
37+
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
38+
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
39+
40+
- name: Extract metadata
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ${{ env.IMAGE_NAME }}
45+
tags: |
46+
type=ref,event=branch,suffix=-amd64
47+
type=ref,event=pr,suffix=-amd64
48+
type=semver,pattern={{version}},suffix=-amd64
49+
type=semver,pattern={{major}}.{{minor}},suffix=-amd64
50+
type=semver,pattern={{major}},suffix=-amd64
51+
type=sha,suffix=-amd64
52+
53+
- name: Build and push Docker image (amd64)
54+
id: build
55+
uses: docker/build-push-action@v5
56+
with:
57+
context: .
58+
platforms: linux/amd64
59+
# push: ${{ github.event_name != 'pull_request' }}
60+
tags: ${{ steps.meta.outputs.tags }}
61+
labels: ${{ steps.meta.outputs.labels }}
62+
cache-from: type=gha,scope=amd64
63+
cache-to: type=gha,mode=max,scope=amd64
64+
65+
build-arm64:
66+
runs-on: ubuntu-latest
67+
permissions:
68+
contents: read
69+
packages: write
70+
outputs:
71+
image-digest: ${{ steps.build.outputs.digest }}
72+
metadata: ${{ steps.meta.outputs.json }}
2273

2374
steps:
2475
- name: Checkout repository
@@ -43,25 +94,60 @@ jobs:
4394
with:
4495
images: ${{ env.IMAGE_NAME }}
4596
tags: |
46-
type=ref,event=branch
47-
type=ref,event=pr
48-
type=semver,pattern={{version}}
49-
type=semver,pattern={{major}}.{{minor}}
50-
type=semver,pattern={{major}}
51-
type=sha
52-
type=raw,value=latest,enable={{is_default_branch}}
53-
54-
- name: Build and push Docker image
97+
type=ref,event=branch,suffix=-arm64
98+
type=ref,event=pr,suffix=-arm64
99+
type=semver,pattern={{version}},suffix=-arm64
100+
type=semver,pattern={{major}}.{{minor}},suffix=-arm64
101+
type=semver,pattern={{major}},suffix=-arm64
102+
type=sha,suffix=-arm64
103+
104+
- name: Build and push Docker image (arm64)
105+
id: build
55106
uses: docker/build-push-action@v5
56107
with:
57108
context: .
58-
platforms: linux/amd64,linux/arm64
109+
platforms: linux/arm64
59110
# push: ${{ github.event_name != 'pull_request' }}
60111
tags: ${{ steps.meta.outputs.tags }}
61112
labels: ${{ steps.meta.outputs.labels }}
62113
cache-from: type=gha
63114
cache-to: type=gha,mode=max
64115

65-
- name: Image digest
66-
if: github.event_name != 'pull_request'
67-
run: echo ${{ steps.docker_build.outputs.digest }}
116+
# create-manifest:
117+
# runs-on: ubuntu-latest
118+
# needs: [build-amd64, build-arm64]
119+
# if: github.event_name != 'pull_request'
120+
# permissions:
121+
# contents: read
122+
# packages: write
123+
#
124+
# steps:
125+
# - name: Log in to Docker Hub
126+
# uses: docker/login-action@v3
127+
# with:
128+
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
129+
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
130+
#
131+
# - name: Extract metadata for manifest
132+
# id: meta
133+
# uses: docker/metadata-action@v5
134+
# with:
135+
# images: ${{ env.IMAGE_NAME }}
136+
# tags: |
137+
# type=ref,event=branch
138+
# type=semver,pattern={{version}}
139+
# type=semver,pattern={{major}}.{{minor}}
140+
# type=semver,pattern={{major}}
141+
# type=sha
142+
# type=raw,value=latest,enable={{is_default_branch}}
143+
#
144+
# - name: Create and push manifest
145+
# run: |
146+
# # Extract base tags (without architecture suffixes)
147+
# for tag in $(echo '${{ steps.meta.outputs.tags }}' | tr '\n' ' '); do
148+
# echo "Creating manifest for: $tag"
149+
# docker manifest create $tag \
150+
# ${tag}-amd64 \
151+
# ${tag}-arm64
152+
# docker manifest push $tag
153+
# done

0 commit comments

Comments
 (0)