From b85036b78ffee2ab8cc036480d469156af1e998f Mon Sep 17 00:00:00 2001 From: PathToLife <12622625+PathToLife@users.noreply.github.com> Date: Mon, 10 Mar 2025 17:28:20 +1300 Subject: [PATCH] Dockerfile manual architecture selection for multiplatform build. Disable NPM Publish for testing --- .github/workflows/releases.yml | 23 +++++++++++++---------- Dockerfile | 11 ++++++++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8bfb8e2d..e6db697b 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -62,12 +62,22 @@ jobs: tags: ${{ steps.image-metadata.outputs.tags }} labels: ${{ steps.image-metadata.outputs.labels }} containerfiles: ./Dockerfile - platforms: linux/amd64,linux/arm64,linux/arm/v7 + archs: amd64,arm64v8,arm32v7 oci: true + # enable build layer caching between platforms + layers: true # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. extra-args: | --ulimit nofile=10000 + - name: Publish to GHCR + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} - name: Upload Release Assets id: upload-release-assets @@ -82,13 +92,6 @@ jobs: - name: Publish to NPM uses: JS-DevTools/npm-publish@v1 + if: false with: - token: ${{ secrets.NPM_TOKEN }} - - - name: Publish to GHCR - uses: redhat-actions/push-to-registry@v2 - with: - tags: ${{ steps.build-image.outputs.tags }} - registry: ${{ env.REGISTRY }} - username: ${{ env.REGISTRY_USER }} - password: ${{ env.REGISTRY_PASSWORD }} + token: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 09350891..05f85ceb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,19 +12,24 @@ COPY package.json . COPY package-lock.json . # Install dependencies -# --ignore-scripts do not run grunt postinstall script as it depends on files other than package.json +# --ignore-scripts prevents postinstall script (which runs grunt) as it depends on files other than package.json RUN npm ci --ignore-scripts -# Build the app +# Copy files needed for postinstall and build COPY . . # npm postinstall runs grunt, which depends on files other than package.json RUN npm run postinstall + +# Build the app RUN npm run build ######################################### # Package static build files into nginx # ######################################### -FROM nginx:stable-alpine AS cyberchef +# We are using Github Actions: redhat-actions/buildah-build@v2 which needs manual selection of arch in base image +# Remove TARGETARCH if docker buildx is supported in the CI release as --platform=$TARGETPLATFORM will be automatically set +ARG TARGETARCH +FROM ${TARGETARCH}/nginx:stable-alpine AS cyberchef COPY --from=builder /app/build/prod /usr/share/nginx/html/