Skip to content

Commit b3b9cdb

Browse files
authored
Enhance GitHub Actions for multi-arch Docker builds
Updated build workflow to support multi-architecture builds for both amd64 and arm64 platforms, including manifest creation.
1 parent 097815e commit b3b9cdb

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,52 @@ jobs:
99
strategy:
1010
matrix:
1111
torch-version: ["2.7.0"]
12+
include:
13+
- arch: amd64
14+
platform: linux/amd64
15+
- arch: arm64
16+
platform: linux/arm64
1217
steps:
1318
- name: Checkout code
1419
uses: actions/checkout@v4
20+
1521
- name: Set up QEMU
1622
uses: docker/setup-qemu-action@v3
1723
with:
18-
platforms: arm64
24+
platforms: ${{ matrix.arch }}
25+
1926
- name: Set up Docker Buildx
2027
uses: docker/setup-buildx-action@v3
28+
2129
- name: Login to Docker Hub
2230
uses: docker/login-action@v3
2331
with:
2432
username: ${{ secrets.DOCKERHUB_USERNAME }}
2533
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
2635
- name: Build and push
2736
uses: docker/build-push-action@v6
2837
with:
2938
context: .
30-
platforms: linux/amd64,linux/arm64
39+
platforms: ${{ matrix.platform }}
3140
push: true
3241
tags: |
33-
freelabspace/python-local:3.10
34-
freelabspace/python-local:latest
42+
freelabspace/python-local:3.10-${{ matrix.arch }}
3543
build-args: |
3644
TORCH_VERSION=${{ matrix.torch-version }}
45+
46+
create-manifest:
47+
runs-on: ubuntu-latest
48+
needs: build
49+
steps:
50+
- name: Login to Docker Hub
51+
uses: docker/login-action@v3
52+
with:
53+
username: ${{ secrets.DOCKERHUB_USERNAME }}
54+
password: ${{ secrets.DOCKERHUB_TOKEN }}
55+
56+
- name: Create and push manifest for latest
57+
run: |
58+
docker buildx imagetools create -t freelabspace/python-local:latest \
59+
freelabspace/python-local:3.10-amd64 \
60+
freelabspace/python-local:3.10-arm64

0 commit comments

Comments
 (0)