Skip to content

Commit f9a84a2

Browse files
committed
Added support for multi-platform builds
1 parent 3187a18 commit f9a84a2

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/docker-build.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
# Will be "NASA-AMMOS/Veloserver" for the main repo, for forks "user-name-of-fork/Veloserver"
2929
# For generating the tag, all will be converted to lowercase
3030
IMAGE_SLUG: ${{ github.repository }}
31+
DOCKER_PLATFORMS: linux/amd64,linux/arm64 # Add this line
3132

3233
jobs:
3334
# Push image to GitHub Container Registry.
@@ -107,11 +108,22 @@ jobs:
107108
echo "REGISTRY_TAGS_PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
108109
echo "SHA_SHORT=$SHA_SHORT" >> $GITHUB_OUTPUT
109110
111+
- name: Set up Docker Buildx
112+
uses: docker/setup-buildx-action@v3
113+
110114
- name: Login to GHCR
111115
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login -u ${{ github.actor }} --password-stdin ghcr.io
112116

113-
- name: Docker build
114-
run: docker build --no-cache ${{ steps.generate.outputs.REGISTRY_TAGS }} .
115-
116-
- name: Docker push
117-
run: docker push ${{ steps.generate.outputs.IMAGE_ID }} --all-tags
117+
- name: Docker build and push
118+
env:
119+
DOCKER_PLATFORM_OPTION: linux/amd64,linux/arm64
120+
run: |
121+
# Convert REGISTRY_TAGS format for buildx
122+
BUILDX_TAGS=$(echo "${{ steps.generate.outputs.REGISTRY_TAGS }}" | sed 's/-t /--tag /g')
123+
124+
docker buildx build \
125+
--platform $DOCKER_PLATFORM_OPTION \
126+
--push \
127+
--no-cache \
128+
$BUILDX_TAGS \
129+
.

0 commit comments

Comments
 (0)