From 40a4872f70f0da19557642a2d43069535114375f Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Tue, 6 Feb 2024 10:26:33 +0000 Subject: [PATCH] Generate prod build inside container --- .github/workflows/pull_requests.yml | 6 +----- .github/workflows/releases.yml | 4 ++++ Containerfile | 8 +++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 654669d1..16fbb6de 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -44,7 +44,7 @@ jobs: with: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} containerfiles: ./Containerfile - platforms: linux/arm64, linux/amd64 + platforms: linux/amd64 oci: true - name: UI Tests @@ -52,7 +52,3 @@ jobs: run: | sudo apt-get install xvfb xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui - image: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c5c4cf2e..c016e24c 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -72,6 +72,10 @@ jobs: containerfiles: ./Containerfile platforms: linux/arm64, linux/amd64 oci: true + # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. + extra-args: | + --ulimit nofile=10000 + - name: Upload Release Assets if: success() diff --git a/Containerfile b/Containerfile index 7727754d..125ef18c 100644 --- a/Containerfile +++ b/Containerfile @@ -1,3 +1,9 @@ +FROM node:18-alpine AS build + +COPY . . +RUN npm ci +RUN npm run build + FROM ghcr.io/static-web-server/static-web-server:2.25-alpine -COPY ./build/prod /public +COPY --from=build ./build/prod /public