From 2981665f1fd1f492621a5ef4a7097deb5161876d Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Thu, 22 Dec 2022 15:52:21 -0500 Subject: [PATCH 1/2] Add BUILDPLATFORM and TARGETPLATFORM flags to speed up builds Signed-off-by: Michael Irwin --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2bc1f44..5e4c759 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ # Install the base requirements for the app. # This stage is to support development. -FROM python:alpine AS base +FROM --platform=$BUILDPLATFORM python:alpine AS base WORKDIR /app COPY 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 COPY app/package.json app/yarn.lock ./ COPY app/spec ./spec @@ -25,16 +25,16 @@ RUN apk add zip && \ zip -r /app.zip /app # 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"] # Do the actual build of the mkdocs site -FROM base AS build +FROM --platform=$BUILDPLATFORM base AS build COPY . . RUN mkdocs build # Extract the static content from the build # 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=build /app/site /usr/share/nginx/html From c4e9cd0f1d5f8cf0a497c7bb7271ebfd2fe28147 Mon Sep 17 00:00:00 2001 From: Michael Irwin Date: Thu, 22 Dec 2022 15:57:09 -0500 Subject: [PATCH 2/2] Add the setup-buildx-action and update build-push-action Signed-off-by: Michael Irwin --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec3f5c0..031f8f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Build - uses: docker/build-push-action@v1 + uses: docker/build-push-action@v3 with: push: false