From 9c1dd07c8975eef9c3aaa9ec4a8bd704c06141a5 Mon Sep 17 00:00:00 2001 From: Floris272 Date: Fri, 31 Jan 2025 15:50:17 +0100 Subject: [PATCH] add frontend to dockerfile --- .github/workflows/ci.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- Dockerfile | 44 +++++++++++++-------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85ded41..744bd1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: python-version: '3.11' optimize-postgres: 'yes' pg-service: 'postgres' - setup-node: 'no' + setup-node: 'yes' apt-packages: 'gettext' - name: Run tests diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dae9fdf..70bb9d4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'python' ] + language: [ 'javascript', 'python' ] steps: - name: Checkout repository diff --git a/Dockerfile b/Dockerfile index 58223d8..6dea9c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,27 +25,27 @@ COPY ./requirements /app/requirements RUN pip install -r requirements/production.txt -# Stage 2 - Install frontend deps and build assets -#FROM node:20-bookworm-slim AS frontend-build -# -#RUN apt-get update && apt-get install -y --no-install-recommends \ -# git \ -# && rm -rf /var/lib/apt/lists/* -# -#WORKDIR /app -# -## copy configuration/build files -#COPY ./build /app/build/ -#COPY ./*.json ./*.js ./.babelrc /app/ -# -## install WITH dev tooling -#RUN npm ci -# -## copy source code -#COPY ./src /app/src -# -## build frontend -#RUN npm run build + Stage 2 - Install frontend deps and build assets +FROM node:20-bookworm-slim AS frontend-build + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# copy configuration/build files +COPY ./build /app/build/ +COPY ./*.json ./*.js ./.babelrc /app/ + +# install WITH dev tooling +RUN npm ci + +# copy source code +COPY ./src /app/src + +# build frontend +RUN npm run build # Stage 3 - Build docker image suitable for production @@ -80,7 +80,7 @@ COPY --from=backend-build /usr/local/bin/celery /usr/local/bin/celery COPY --from=backend-build /app/src/ /app/src/ # copy frontend build statics -# COPY --from=frontend-build /app/src/open_producten/static /app/src/open_producten/static +COPY --from=frontend-build /app/src/open_producten/static /app/src/open_producten/static # copy source code COPY ./src /app/src