Add BUILDPLATFORM and TARGETPLATFORM flags to speed up builds
Signed-off-by: Michael Irwin <mikesir87@gmail.com>
This commit is contained in:
parent
d9f0c9ac45
commit
2981665f1f
10
Dockerfile
10
Dockerfile
@ -1,11 +1,11 @@
|
|||||||
# Install the base requirements for the app.
|
# Install the base requirements for the app.
|
||||||
# This stage is to support development.
|
# This stage is to support development.
|
||||||
FROM python:alpine AS base
|
FROM --platform=$BUILDPLATFORM python:alpine AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
FROM node:18-alpine AS app-base
|
FROM --platform=$BUILDPLATFORM node:18-alpine AS app-base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY app/package.json app/yarn.lock ./
|
COPY app/package.json app/yarn.lock ./
|
||||||
COPY app/spec ./spec
|
COPY app/spec ./spec
|
||||||
@ -25,16 +25,16 @@ RUN apk add zip && \
|
|||||||
zip -r /app.zip /app
|
zip -r /app.zip /app
|
||||||
|
|
||||||
# Dev-ready container - actual files will be mounted in
|
# Dev-ready container - actual files will be mounted in
|
||||||
FROM base AS dev
|
FROM --platform=$BUILDPLATFORM base AS dev
|
||||||
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
CMD ["mkdocs", "serve", "-a", "0.0.0.0:8000"]
|
||||||
|
|
||||||
# Do the actual build of the mkdocs site
|
# Do the actual build of the mkdocs site
|
||||||
FROM base AS build
|
FROM --platform=$BUILDPLATFORM base AS build
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN mkdocs build
|
RUN mkdocs build
|
||||||
|
|
||||||
# Extract the static content from the build
|
# Extract the static content from the build
|
||||||
# and use a nginx image to serve the content
|
# and use a nginx image to serve the content
|
||||||
FROM nginx:alpine
|
FROM --platform=$TARGETPLATFORM nginx:alpine
|
||||||
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
COPY --from=app-zip-creator /app.zip /usr/share/nginx/html/assets/app.zip
|
||||||
COPY --from=build /app/site /usr/share/nginx/html
|
COPY --from=build /app/site /usr/share/nginx/html
|
||||||
|
Loading…
Reference in New Issue
Block a user