From 6f836e2c9b5f0765e7971e0a9ae2549806c3e036 Mon Sep 17 00:00:00 2001 From: Ronald Moesbergen Date: Fri, 3 May 2024 15:49:43 +0200 Subject: [PATCH] ci: build outside docker so env vars work --- .dockerignore | 1 - .github/workflows/deploy.yaml | 13 +++++++++++++ Dockerfile | 12 +----------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.dockerignore b/.dockerignore index 51337f0..bfb563a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ node_modules/ -dist/ .git/ .github/ diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 40f8831..311fdd6 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -22,6 +22,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-node@v4 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + - name: Create TEST env file if: github.ref_type == 'branch' run: | @@ -34,6 +39,14 @@ jobs: VITE_SENTRY_SAMPLE_RATE="1.0" EOF + - name: Build application + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + run: | + export NODE_OPTIONS="--max-old-space-size=4096" + yarn --frozen-lockfile --prefer-offline + yarn build + - name: Build and push TEST Docker image if: github.ref_type == 'branch' uses: docker/build-push-action@v5 diff --git a/Dockerfile b/Dockerfile index b91d716..66aac57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,3 @@ -FROM node:20 as builder - -COPY . /build -WORKDIR /build - -# Prevent vite build OOM -ENV NODE_OPTIONS="--max-old-space-size=4096" - -RUN yarn install --frozen-lockfile && yarn build - FROM nginx:stable -COPY --from=builder /build/dist /usr/share/nginx/html +COPY dist /usr/share/nginx/html