Skip to content

Commit ff28317

Browse files
committed
Enable multi-platform container build.
1 parent 0e724fa commit ff28317

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tasks.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,12 @@ def docker_build(ctx: Context):
165165

166166
message_box('Building "docker" image...')
167167

168-
ctx.run(
169-
"docker build -t {0}/{1}:latest -t {0}/{1}:v{2} .".format(
170-
ORG, CONTAINER, app.__version__
168+
for platform in ("arm64", "amd64"):
169+
ctx.run(
170+
f"docker build --platform=linux/{platform} "
171+
f"-t {ORG}/{CONTAINER}:latest-{platform} "
172+
f"-t {ORG}/{CONTAINER}:v{app.__version__}-{platform} ."
171173
)
172-
)
173174

174175

175176
@task
@@ -210,15 +211,15 @@ def docker_run(ctx: Context):
210211
message_box('Running "docker" container...')
211212
ctx.run(
212213
"docker run -d "
213-
"--name={1} "
214+
f"--name={CONTAINER} "
214215
"-e COLOUR_DASH_SERVER=https://www.colour-science.org:8010/ "
215216
"-e COLOUR_DASH_CSS="
216217
"https://www.colour-science.org/assets/css/all-nocdn.css "
217218
"-e COLOUR_DASH_JS="
218219
"https://www.colour-science.org/assets/js/analytics.js,"
219220
"https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.6.1/"
220221
"iframeResizer.contentWindow.min.js "
221-
"-p 8010:8000 {0}/{1}".format(ORG, CONTAINER)
222+
f"-p 8010:8000 {ORG}/{CONTAINER}"
222223
)
223224

224225

@@ -234,4 +235,4 @@ def docker_push(ctx: Context):
234235
"""
235236

236237
message_box('Pushing "docker" container...')
237-
ctx.run(f"docker push {ORG}/{CONTAINER}")
238+
ctx.run(f"docker push --all-tags {ORG}/{CONTAINER}")

0 commit comments

Comments
 (0)