Multi-arch capable Dockerfile

This commit is contained in:
Quentin Gliech 2022-02-02 15:26:02 +01:00
parent 97391663d3
commit eec3157c54
No known key found for this signature in database
GPG Key ID: 22D62B84552719FC
2 changed files with 13 additions and 6 deletions

View File

@ -1,9 +1,14 @@
FROM docker.io/node:alpine as builder
FROM --platform=${BUILDPLATFORM} docker.io/library/node:16.13-alpine3.15 as builder
RUN apk add --no-cache git python3 build-base
COPY . /app
WORKDIR /app
RUN yarn install \
&& yarn build
FROM docker.io/nginx:alpine
# Install the dependencies first
COPY yarn.lock package.json ./
RUN yarn install
# Copy the rest and build the app
COPY . .
RUN yarn build
FROM --platform=${TARGETPLATFORM} docker.io/library/nginx:alpine
COPY --from=builder /app/target /usr/share/nginx/html

View File

@ -35,7 +35,9 @@ To stop the container, simply hit `ctrl+c`.
In this repository, create a Docker image:
```
```sh
# Enable BuildKit https://docs.docker.com/develop/develop-images/build_enhancements/
export DOCKER_BUILDKIT=1
docker build -t hydrogen .
```