Skip to content

Commit bd03fdc

Browse files
authored
Merge pull request #3655 from infotroph/docker-use-arm-45
[docker] Add ARM support where available from upstream
2 parents bff6203 + 4ca1e5a commit bd03fdc

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

.github/workflows/docker.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,20 @@ jobs:
6262
- id: default
6363
if: github.event_name != 'schedule'
6464
run: echo "R_VERSION=${{ github.event.inputs.r_version || env.DEFAULT_R_VERSION }}" >> "$GITHUB_OUTPUT"
65+
- id: platform
66+
# upstream rocker/tidyverse image is only on ARM for R 4.5.* (so far)
67+
shell: bash
68+
run: |
69+
if [[ "${{ join(steps.*.outputs.R_VERSION, '') }}" == "4.5" ]]; then
70+
echo "PLATFORMS=linux/amd64,linux/arm64" >> "$GITHUB_OUTPUT"
71+
else
72+
echo "PLATFORMS=linux/amd64" >> "$GITHUB_OUTPUT"
73+
fi
6574
outputs:
6675
# Note: "steps.*" seems to mean "all step ids", not "all steps"
6776
# If seeing weird results here, check that all steps above have an id set.
6877
R_VERSION: ${{ join(steps.*.outputs.R_VERSION, '') }}
78+
PLATFORMS: ${{ join(steps.platform.outputs.PLATFORMS, '') }}
6979

7080
# ----------------------------------------------------------------------
7181
# depends image has all the dependencies installed
@@ -80,7 +90,7 @@ jobs:
8090
build-context: docker/depends
8191
dockerfile: docker/depends/Dockerfile
8292
r-version: ${{ needs.rversion.outputs.R_VERSION }}
83-
platforms: "linux/amd64"
93+
platforms: ${{ needs.rversion.outputs.PLATFORMS }}
8494
secrets: inherit
8595

8696
# ----------------------------------------------------------------------
@@ -95,7 +105,7 @@ jobs:
95105
dockerfile: docker/base/Dockerfile
96106
r-version: ${{ needs.rversion.outputs.R_VERSION }}
97107
parent-image: "depends"
98-
platforms: "linux/amd64"
108+
platforms: ${{ needs.rversion.outputs.PLATFORMS }}
99109
secrets: inherit
100110

101111
# ----------------------------------------------------------------------
@@ -110,6 +120,7 @@ jobs:
110120
dockerfile: docker/models/Dockerfile
111121
r-version: ${{ needs.rversion.outputs.R_VERSION }}
112122
parent-image: "base"
123+
platforms: ${{ needs.rversion.outputs.PLATFORMS }}
113124
secrets: inherit
114125

115126
# ----------------------------------------------------------------------
@@ -131,37 +142,31 @@ jobs:
131142
- name: basgra
132143
CONTEXT: models/basgra
133144
DOCKERFILE: models/basgra/Dockerfile
134-
PLATFORM: "linux/amd64"
135145
MODEL: basgra
136146
VERSION: BASGRA_N_v1
137147
- name: biocro
138148
CONTEXT: models/biocro
139149
DOCKERFILE: models/biocro/Dockerfile
140-
PLATFORM: "linux/amd64"
141150
MODEL: biocro
142151
VERSION: "0.95"
143152
# - name: ed2_2.2.0
144153
# CONTEXT: models/ed
145154
# DOCKERFILE: models/ed/Dockerfile
146-
# PLATFORM: "linux/amd64"
147155
# MODEL: ed2
148156
# VERSION: "2.2.0"
149157
- name: ed2_git
150158
CONTEXT: models/ed
151159
DOCKERFILE: models/ed/Dockerfile
152-
PLATFORM: "linux/amd64"
153160
MODEL: ed2
154161
VERSION: "git"
155162
- name: maespa
156163
CONTEXT: models/maespa
157164
DOCKERFILE: models/maespa/Dockerfile
158-
PLATFORM: "linux/amd64"
159165
MODEL: maespa
160166
VERSION: "git"
161167
- name: sipnet
162168
CONTEXT: models/sipnet
163169
DOCKERFILE: models/sipnet/Dockerfile
164-
PLATFORM: "linux/amd64"
165170
MODEL: sipnet
166171
VERSION: "git"
167172
uses: ./.github/workflows/docker-build-image.yml
@@ -172,7 +177,7 @@ jobs:
172177
r-version: ${{ needs.rversion.outputs.R_VERSION }}
173178
parent-image: "models"
174179
model-version: ${{ matrix.VERSION }}
175-
platforms: ${{ matrix.PLATFORM }}
180+
platforms: ${{ needs.rversion.outputs.PLATFORMS }}
176181
secrets: inherit
177182

178183
# ----------------------------------------------------------------------
@@ -191,23 +196,20 @@ jobs:
191196
- name: docs
192197
CONTEXT: .
193198
DOCKERFILE: docker/docs/Dockerfile
194-
PLATFORM: "linux/amd64"
195199
- name: executor
196200
CONTEXT: docker/executor
197201
DOCKERFILE: docker/executor/Dockerfile
198-
PLATFORM: "linux/amd64"
199202
- name: api
200203
CONTEXT: apps/api
201204
DOCKERFILE: apps/api/Dockerfile
202-
PLATFORM: "linux/amd64"
203205
uses: ./.github/workflows/docker-build-image.yml
204206
with:
205207
image-name: ${{ matrix.name }}
206208
build-context: ${{ matrix.CONTEXT }}
207209
dockerfile: ${{ matrix.DOCKERFILE }}
208210
r-version: ${{ needs.rversion.outputs.R_VERSION }}
209211
parent-image: "base"
210-
platforms: ${{ matrix.PLATFORM }}
212+
platforms: ${{ needs.rversion.outputs.PLATFORMS }}
211213
secrets: inherit
212214

213215
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)