Skip to content

Commit 2981665

Browse files
committed
Add BUILDPLATFORM and TARGETPLATFORM flags to speed up builds
Signed-off-by: Michael Irwin <mikesir87@gmail.com>
1 parent d9f0c9a commit 2981665

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Install the base requirements for the app.
22
# This stage is to support development.
3-
FROM python:alpine AS base
3+
FROM --platform=$BUILDPLATFORM python:alpine AS base
44
WORKDIR /app
55
COPY requirements.txt .
66
RUN pip install -r requirements.txt
77

8-
FROM node:18-alpine AS app-base
8+
FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
99
WORKDIR /app
1010
COPY app/package.json app/yarn.lock ./
1111
COPY app/spec ./spec
@@ -25,16 +25,16 @@ RUN apk add zip && \
2525
zip -r /app.zip /app
2626

2727
# Dev-ready container - actual files will be mounted in
28-
FROM base AS dev
28+
FROM --platform=$BUILDPLATFORM base AS dev
2929
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
3030

3131
# Do the actual build of the mkdocs site
32-
FROM base AS build
32+
FROM --platform=$BUILDPLATFORM base AS build
3333
COPY . .
3434
RUN mkdocs build
3535

3636
# Extract the static content from the build
3737
# and use a nginx image to serve the content
38-
FROM nginx:alpine
38+
FROM --platform=$TARGETPLATFORM nginx:alpine
3939
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
4040
COPY --from=build /app/site /usr/share/nginx/html

0 commit comments

Comments
 (0)