Dockerfile: always use host platform for build stage

Compiled assets and JavaScript files can run on any platform. So
always use host platform for build to eliminate emulation overhead.

Note that BUILDPLATFORM is new and requires docker buildx. It falls
back to amd64.
This commit is contained in:
Jesse Chan
2020-11-28 22:32:35 +08:00
parent b00572a6fc
commit 81eebe4506

View File

@@ -3,9 +3,10 @@
# secrets, uncommitted changes or other sensitive information. DO NOT
# publish the result image unless it was composed in a clean environment.
ARG BUILDPLATFORM=amd64
ARG NODE_IMAGE=node:alpine
FROM ${NODE_IMAGE} as nodebuild
FROM --platform=$BUILDPLATFORM ${NODE_IMAGE} as nodebuild
WORKDIR /usr/src/app/