Skip to content

Commit af4ba1d

Browse files
feat: Add ARM64 Docker image support
- Added QEMU emulation to CI workflow for ARM64 builds - Updated all build jobs to support linux/amd64,linux/arm64 platforms - Use dynamic repository owner for image tags - Sanitize branch names for Docker tags (replace / with -) - Add fallback for git describe --tags Cherry-picked from postalserver/postal PR postalserver#3516 Co-authored-by: aalonzolu <5524124+aalonzolu@users.noreply.github.com> Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 1fb6de1 commit af4ba1d

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
- uses: actions/checkout@v4
2525
with:
2626
fetch-depth: 0
27+
- uses: docker/setup-qemu-action@v3
2728
- uses: docker/setup-buildx-action@v2
2829
- uses: docker/login-action@v2
2930
with:
@@ -33,11 +34,11 @@ jobs:
3334
- uses: docker/build-push-action@v4
3435
with:
3536
push: true
36-
tags: ghcr.io/postalserver/postal:ci-${{ github.sha }}
37+
tags: ghcr.io/${{ github.repository_owner }}/postal:ci-${{ github.sha }}
3738
cache-from: type=gha
3839
cache-to: type=gha,mode=max
3940
target: ci
40-
platforms: linux/amd64
41+
platforms: linux/amd64,linux/arm64
4142

4243
test:
4344
name: Test Suite
@@ -54,10 +55,10 @@ jobs:
5455
password: ${{ secrets.GITHUB_TOKEN }}
5556
- run: docker compose pull
5657
env:
57-
POSTAL_IMAGE: ghcr.io/postalserver/postal:ci-${{ github.sha }}
58+
POSTAL_IMAGE: ghcr.io/${{ github.repository_owner }}/postal:ci-${{ github.sha }}
5859
- run: docker compose run postal sh -c 'bundle exec rspec'
5960
env:
60-
POSTAL_IMAGE: ghcr.io/postalserver/postal:ci-${{ github.sha }}
61+
POSTAL_IMAGE: ghcr.io/${{ github.repository_owner }}/postal:ci-${{ github.sha }}
6162

6263
release-branch:
6364
name: Release (branch)
@@ -80,20 +81,23 @@ jobs:
8081
password: ${{ secrets.GITHUB_TOKEN }}
8182
- id: info
8283
run: |
83-
IMAGE=ghcr.io/postalserver/postal
84+
IMAGE=ghcr.io/${{ github.repository_owner }}/postal
8485
8586
REF="${GITHUB_REF#refs/heads/}"
8687
if [ -z "$REF" ]; then exit 1; fi
8788
88-
VER="$(git describe --tags 2>/dev/null)"
89+
# Sanitize branch name for Docker tags (replace / with -)
90+
SAFE_REF="${REF//\//-}"
91+
92+
VER="$(git describe --tags 2>/dev/null || echo 'dev')"
8993
echo "version=${VER}" >> "$GITHUB_OUTPUT"
9094
echo "branch=${REF}" >> "$GITHUB_OUTPUT"
9195
9296
echo 'tags<<EOF' >> "$GITHUB_OUTPUT"
9397
if [[ "$REF" == "main" ]]; then
9498
echo "${IMAGE}:latest" >> "$GITHUB_OUTPUT"
9599
else
96-
echo "${IMAGE}:branch-${REF}" >> "$GITHUB_OUTPUT"
100+
echo "${IMAGE}:branch-${SAFE_REF}" >> "$GITHUB_OUTPUT"
97101
fi
98102
echo 'EOF' >> "$GITHUB_OUTPUT"
99103
- uses: docker/build-push-action@v4
@@ -103,7 +107,7 @@ jobs:
103107
cache-from: type=gha
104108
cache-to: type=gha,mode=max
105109
target: full
106-
platforms: linux/amd64
110+
platforms: linux/amd64,linux/arm64
107111
build-args: |
108112
VERSION=${{ steps.info.outputs.version }}
109113
BRANCH=${{ steps.info.outputs.branch }}
@@ -126,11 +130,11 @@ jobs:
126130
with:
127131
push: true
128132
tags: |
129-
ghcr.io/postalserver/postal:stable
130-
ghcr.io/postalserver/postal:${{ needs.release-please.outputs.version }}
133+
ghcr.io/${{ github.repository_owner }}/postal:stable
134+
ghcr.io/${{ github.repository_owner }}/postal:${{ needs.release-please.outputs.version }}
131135
cache-from: type=gha
132136
cache-to: type=gha,mode=max
133137
target: full
134138
build-args: |
135139
VERSION=${{ needs.release-please.outputs.version }}
136-
platforms: linux/amd64
140+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)