Skip to content

Commit 9bf3f88

Browse files
authored
Merge pull request #733 from NASA-AMMOS/jr-652-update
- Include amd64 Docker image suffix and build it last so that it takes precedent over arm64 - Remove extraneous image tags and unknown OS when building Docker images with GitHub Actions
2 parents a46410c + bf13c62 commit 9bf3f88

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

.github/workflows/docker-build.yml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,50 +110,52 @@ jobs:
110110
echo "REGISTRY_TAGS_PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
111111
echo "SHA_SHORT=$SHA_SHORT" >> $GITHUB_OUTPUT
112112
113-
# Build and push AMD64 image on x64 runner
114-
build-amd64:
113+
# Build and push ARM64 image on ARM64 runner
114+
build-arm64:
115115
needs: generate-tags
116-
runs-on: ubuntu-latest # x64 runner for native AMD64 builds
116+
runs-on: ubuntu-24.04-arm # ARM64 runner for native ARM64 builds
117117
steps:
118118
- name: Checkout
119119
uses: actions/checkout@v3
120120

121-
- name: Set up Docker Buildx
122-
uses: docker/setup-buildx-action@v3
123-
124121
- name: Login to GHCR
125-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} --password-stdin ghcr.io
122+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
123+
with:
124+
registry: ghcr.io
125+
username: ${{ github.actor }}
126+
password: ${{ secrets.GITHUB_TOKEN }}
126127

127-
- name: Docker buildx build and push (AMD64)
128+
- name: Docker buildx build and push (ARM64)
128129
run: |
129-
docker buildx build \
130-
--platform linux/amd64 \
131-
${{ needs.generate-tags.outputs.registry-tags }} \
130+
# Generate ARM64-specific tags by adding -arm64 suffix
131+
ARM64_TAGS="${{ needs.generate-tags.outputs.registry-tags }}-arm64"
132+
docker build \
133+
${ARM64_TAGS} \
132134
--push \
133135
--no-cache \
134136
.
135137
136-
# Build and push ARM64 image on ARM64 runner
137-
build-arm64:
138-
needs: generate-tags
139-
runs-on: ubuntu-24.04-arm # ARM64 runner for native ARM64 builds
138+
# Build and push AMD64 image on x64 runner
139+
build-amd64:
140+
needs: [generate-tags, build-arm64] # Build amd64 last so that it shows as the latest
141+
runs-on: ubuntu-latest # x64 runner for native AMD64 builds
140142
steps:
141143
- name: Checkout
142144
uses: actions/checkout@v3
143145

144-
- name: Set up Docker Buildx
145-
uses: docker/setup-buildx-action@v3
146-
147146
- name: Login to GHCR
148-
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} --password-stdin ghcr.io
147+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
148+
with:
149+
registry: ghcr.io
150+
username: ${{ github.actor }}
151+
password: ${{ secrets.GITHUB_TOKEN }}
149152

150-
- name: Docker buildx build and push (ARM64)
153+
- name: Docker buildx build and push (AMD64)
151154
run: |
152-
# Generate ARM64-specific tags by adding -arm64 suffix
153-
ARM64_TAGS="${{ needs.generate-tags.outputs.registry-tags }}-arm64"
154-
docker buildx build \
155-
--platform linux/arm64 \
156-
${ARM64_TAGS} \
155+
# Generate AMD64-specific tags by adding -amd64 suffix
156+
AMD64_TAGS="${{ needs.generate-tags.outputs.registry-tags }}-amd64"
157+
docker build \
158+
${AMD64_TAGS} \
157159
--push \
158160
--no-cache \
159161
.

0 commit comments

Comments
 (0)