Skip to content

Commit 46ada3c

Browse files
author
Madan Shah
committed
fix(ci): drop ARM64 QEMU build, add GHA layer cache, fix credential ordering
- Switch DOCKER_PLATFORMS from linux/amd64,linux/arm64 to linux/amd64 only; mosaic node group uses c6id.2xlarge (Intel x86_64), ARM64 via QEMU was causing OOM/timeout after 73 minutes - Add --cache-from/--cache-to type=gha to the buildx build step so Rust compile layers are reused across runs - Split build into two steps: build+push to private ECR first (with private credentials active), then configure public ECR credentials and re-tag via imagetools create -- fixes credential overwrite bug - Fix concurrency group key (was hardcoded SHA, now uses github.ref)
1 parent 9b042fd commit 46ada3c

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

.github/workflows/docker-publish-ecr.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ env:
2424
PUBLIC_ECR_REPOSITORY: mosaic
2525
PUBLIC_ECR_REGION: us-east-1
2626
DEFAULT_BUILD_REF: bae62a54b7137e811653d5dd89975e10f0e71676
27-
DOCKER_PLATFORMS: linux/amd64,linux/arm64
27+
DOCKER_PLATFORMS: linux/amd64
2828

2929
permissions:
3030
contents: read
3131

3232
concurrency:
33-
group: docker-publish-ecr-${{ inputs.ref || 'bae62a54b7137e811653d5dd89975e10f0e71676' }}
33+
group: docker-publish-ecr-${{ inputs.ref || github.ref }}
3434
cancel-in-progress: false
3535

3636
jobs:
@@ -132,6 +132,18 @@ jobs:
132132
- name: Set up Docker Buildx
133133
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
134134

135+
- name: Build and push Mosaic image to private ECR
136+
run: |
137+
set -euo pipefail
138+
docker buildx build \
139+
--platform "${DOCKER_PLATFORMS}" \
140+
--file docker/Dockerfile \
141+
--cache-from "type=gha,scope=mosaic" \
142+
--cache-to "type=gha,scope=mosaic,mode=max" \
143+
--tag "${IMAGE_REF}" \
144+
--push \
145+
.
146+
135147
- name: Configure public ECR credentials
136148
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
137149
with:
@@ -143,16 +155,12 @@ jobs:
143155
aws ecr-public get-login-password --region "${PUBLIC_ECR_REGION}" \
144156
| docker login --username AWS --password-stdin "${PUBLIC_ECR_REGISTRY}"
145157
146-
- name: Build and push Mosaic images
158+
- name: Push Mosaic image to public ECR
147159
run: |
148160
set -euo pipefail
149-
docker buildx build \
150-
--platform "${DOCKER_PLATFORMS}" \
151-
--file docker/Dockerfile \
152-
--tag "${IMAGE_REF}" \
161+
docker buildx imagetools create \
153162
--tag "${PUBLIC_IMAGE_REF}" \
154-
--push \
155-
.
163+
"${IMAGE_REF}"
156164
157165
- name: Reconfigure private AWS credentials
158166
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2

0 commit comments

Comments
 (0)