Skip to content

Commit 1e4bfec

Browse files
committed
ci: build and push multi platform image
- change image.yml github action to build and push an OCI compatible multi-platform image
1 parent 204624c commit 1e4bfec

File tree

1 file changed

+71
-38
lines changed

1 file changed

+71
-38
lines changed

.github/workflows/image.yml

Lines changed: 71 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,26 @@ jobs:
1515
build-image:
1616
permissions:
1717
packages: write
18-
strategy:
19-
matrix:
20-
arch: ["amd64", "arm64"]
18+
# strategy:
19+
# matrix:
20+
# arch: ["amd64", "arm64"]
2121

22-
runs-on: |-
23-
${{fromJson('{
24-
"amd64": "ubuntu-20.04",
25-
"arm64": "ubuntu-22.04-arm"
26-
}')[matrix.arch] }}
22+
# runs-on: |-
23+
# ${{fromJson('{
24+
# "amd64": "ubuntu-20.04",
25+
# "arm64": "ubuntu-22.04-arm"
26+
# }')[matrix.arch] }}
27+
runs-on: ubuntu-24.04
2728

2829
env:
2930
# IMG_CACHE: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-latest
30-
IMG_VERSIONED: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-${{ github.sha }}
31-
NIGHTLY_IMG_CACHE: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-nightly
32-
BUILDER_IMG_CACHE: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-builder
31+
# IMG_VERSIONED: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-${{ github.sha }}
32+
# NIGHTLY_IMG_CACHE: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-nightly
33+
# BUILDER_IMG_CACHE: ghcr.io/measure-sh/symbolicator:${{ matrix.arch }}-builder
34+
IMG_VERSIONED: ghcr.io/measure-sh/symbolicator:${{ github.sha }}
35+
NIGHTLY_IMG_CACHE: ghcr.io/measure-sh/symbolicator:nightly
36+
BUILDER_IMG_CACHE: ghcr.io/measure-sh/symbolicator:builder
37+
3338
steps:
3439
- uses: actions/checkout@v4
3540
with:
@@ -38,45 +43,73 @@ jobs:
3843
- name: Docker Login
3944
run: docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
4045

41-
- name: build builder img
46+
# - name: build builder img
47+
# run: |
48+
# set -euxo pipefail
49+
# args=()
50+
# if docker pull -q "$BUILDER_IMG_CACHE"; then
51+
# args+=(--cache-from "$BUILDER_IMG_CACHE")
52+
# fi
53+
# docker buildx build \
54+
# "${args[@]}" \
55+
# --build-arg BUILDKIT_INLINE_CACHE=1 \
56+
# --platform linux/${{ matrix.arch }} \
57+
# --tag "$BUILDER_IMG_CACHE" \
58+
# --target symbolicator-build \
59+
# .
60+
61+
- name: Set up Docker Buildx
62+
uses: docker/setup-buildx-action@v3
63+
64+
# - name: build nightly img
65+
# run: |
66+
# set -euxo pipefail
67+
# args=()
68+
# if docker pull -q "$NIGHTLY_IMG_CACHE"; then
69+
# args+=(--cache-from "$NIGHTLY_IMG_CACHE")
70+
# fi
71+
# docker buildx build \
72+
# "${args[@]}" \
73+
# --build-arg BUILDKIT_INLINE_CACHE=1 \
74+
# --platform linux/${{ matrix.arch }} \
75+
# --tag "$NIGHTLY_IMG_CACHE" \
76+
# --tag "$IMG_VERSIONED" \
77+
# --cache-from "${BUILDER_IMG_CACHE}" \
78+
# --cache-from "${NIGHTLY_IMG_CACHE}" \
79+
# .
80+
81+
# - name: push all images
82+
# if: github.event_name != 'pull_request'
83+
# run: |
84+
# docker push "$BUILDER_IMG_CACHE"
85+
# docker push "$NIGHTLY_IMG_CACHE"
86+
# docker push "$IMG_VERSIONED"
87+
88+
# # for now arm64 is too slow so just retag this as latest
89+
# docker tag "$IMG_VERSIONED" ghcr.io/measure-sh/symbolicator:latest
90+
# docker push ghcr.io/measure-sh/symbolicator:latest
91+
92+
- name: Build and push OCI multi-platform image
4293
run: |
4394
set -euxo pipefail
4495
args=()
4596
if docker pull -q "$BUILDER_IMG_CACHE"; then
4697
args+=(--cache-from "$BUILDER_IMG_CACHE")
4798
fi
48-
docker buildx build \
49-
"${args[@]}" \
50-
--build-arg BUILDKIT_INLINE_CACHE=1 \
51-
--platform linux/${{ matrix.arch }} \
52-
--tag "$BUILDER_IMG_CACHE" \
53-
--target symbolicator-build \
54-
.
55-
56-
- name: build nightly img
57-
run: |
58-
set -euxo pipefail
59-
args=()
6099
if docker pull -q "$NIGHTLY_IMG_CACHE"; then
61100
args+=(--cache-from "$NIGHTLY_IMG_CACHE")
62101
fi
63102
docker buildx build \
64-
"${args[@]}" \
65-
--build-arg BUILDKIT_INLINE_CACHE=1 \
66-
--platform linux/${{ matrix.arch }} \
67-
--tag "$NIGHTLY_IMG_CACHE" \
68-
--tag "$IMG_VERSIONED" \
69-
--cache-from "${BUILDER_IMG_CACHE}" \
70-
--cache-from "${NIGHTLY_IMG_CACHE}" \
71-
.
103+
"${args[@]}" \
104+
--build-arg BUILD_KIT_INLINE_CACHE=1 \
105+
--platform linux/amd64,linux/arm64 \
106+
--tag "$NIGHTLY_IMG_CACHE" \
107+
--tag "$IMG_VERSIONED" \
108+
--push .
72109
73-
- name: push all images
110+
- name: Retag as latest and push
74111
if: github.event_name != 'pull_request'
75112
run: |
76-
docker push "$BUILDER_IMG_CACHE"
77-
docker push "$NIGHTLY_IMG_CACHE"
78-
docker push "$IMG_VERSIONED"
79-
80-
# for now arm64 is too slow so just retag this as latest
113+
docker pull "$IMG_VERSIONED"
81114
docker tag "$IMG_VERSIONED" ghcr.io/measure-sh/symbolicator:latest
82115
docker push ghcr.io/measure-sh/symbolicator:latest

0 commit comments

Comments
 (0)