File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,13 +103,17 @@ jobs:
103103
104104 # Job 3: Build and Push Docker Image
105105 build :
106- name : Build Docker Image
107- runs-on : ubuntu-latest
106+ name : Build Docker image for ${{ matrix.platform }}
107+ runs-on : ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
108+
108109 needs : update-lockfile
109110
110111 strategy :
111112 fail-fast : false
112113 matrix :
114+ platform :
115+ - linux/amd64
116+ - linux/arm64
113117 service :
114118 - app
115119 - jupyter
@@ -130,6 +134,16 @@ jobs:
130134 # image_suffix: /cpu-action
131135
132136 steps :
137+ - name : Prepare environment for current platform
138+ # This step sets up the environment for the current platform being built.
139+ # It replaces the '/' character in the platform name with '-' and sets it as an environment variable.
140+ # This is useful for naming artifacts and other resources that cannot contain '/'.
141+ # The environment variable PLATFORMS_PAIR will be used later in the workflow.
142+ id : prepare
143+ run : |
144+ platform=${{ matrix.platform }}
145+ echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
146+
133147 - uses : actions/checkout@v6
134148 with :
135149 ref : ${{ github.head_ref || github.ref_name }}
@@ -151,8 +165,11 @@ jobs:
151165
152166 - name : Build and push Docker image
153167 uses : docker/build-push-action@v7
168+ env :
169+ DOCKER_BUILDKIT : 1
154170 with :
155171 context : .
172+ platforms : ${{ matrix.platform }}
156173 build-args : |
157174 UV_VERSION=${{ env.UV_VERSION }}
158175 PYTHON_VERSION=${{ env.PYTHON_VERSION }}
You can’t perform that action at this time.
0 commit comments