From e27dd986bc57539003dd3226ebe57fb357dc4a0f Mon Sep 17 00:00:00 2001 From: DaanSelen <80752476+DaanSelen@users.noreply.github.com> Date: Mon, 26 Oct 2026 00:26:03 +0100 Subject: [PATCH] feat: rebuild frontend on every commit (#1383) * feat: rebuild frontend on every commit * chore: revert to latest --- .dockerignore | 11 ++++++++--- docker/Dockerfile | 43 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7aaadbd9..72cc2151 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,14 @@ .git .github -*.md tests/ docs/ + +*.md + +**/node_modules +**/venv +**/__pycache__ +**/*.pyc + src/db src/wg-dashboard.ini -src/static/app -src/static/client diff --git a/docker/Dockerfile b/docker/Dockerfile index 9ed2344a..31bddbf5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,7 @@ # # Pull the current golang-alpine image. -FROM golang:1.27-alpine3.23 AS awg-go +FROM golang:1.26-alpine3.24 AS awg-go # Install build-dependencies. RUN apk add --no-cache \ @@ -55,7 +55,7 @@ RUN make && chmod +x wg* # # Use the python-alpine image for building pip dependencies -FROM python:3.14-alpine3.23 AS pip-builder +FROM python:3.14-alpine3.24 AS pip-builder ARG TARGETPLATFORM @@ -85,13 +85,32 @@ RUN . /opt/wgdashboard/src/venv/bin/activate && \ pip3 install --upgrade pip && \ pip3 install -r /opt/wgdashboard/src/requirements.txt +# +# WGDashboard FRONTEND BUILDING +# Base: Node Alpine +# +FROM node:26-alpine3.24 AS frontend-builder + +WORKDIR /workspace + +# Copy frontend source, package files and lockfiles +COPY ./src/static/ ./ + +# Build the admin frontend +WORKDIR /workspace/app +RUN npm ci && npm run build + +# Build the client frontend +WORKDIR /workspace/client +RUN npm ci && npm run build + # # WGDashboard RUNNING STAGE # Base: Alpine # # Running with the python-alpine image. -FROM python:3.14-alpine3.23 AS final +FROM python:3.14-alpine3.24 AS final LABEL maintainer="dselen@nerthus.nl" # Install only the runtime dependencies @@ -121,11 +140,25 @@ ENV TZ="Europe/Amsterdam" \ RUN mkdir /data /configs -p ${WGDASH}/src /etc/amnezia/amneziawg \ && echo "name_servers=${global_dns}" >> /etc/resolvconf.conf -# Copy the venv and source files from local compiled locations or repos +# Copy application source COPY ./src ${WGDASH}/src -COPY --from=pip-builder /opt/wgdashboard/src/venv /opt/wgdashboard/src/venv + +# Copy Python dependencies +COPY --from=pip-builder \ + /opt/wgdashboard/src/venv \ + ${WGDASH}/src/venv + +RUN rm -rf ${WGDASH}/src/static/dist \ + ${WGDASH}/src/static/app \ + ${WGDASH}/src/static/client + +COPY --from=frontend-builder \ + /workspace/dist/ \ + ${WGDASH}/src/static/dist/ + COPY ./docker/wg0.conf.template /tmp/wg0.conf.template COPY ./docker/wg-dashboard-oidc-providers.json.template /tmp/wg-dashboard-oidc-providers.json.template + # Copy in the runtime script, essential. COPY ./docker/entrypoint.sh /entrypoint.sh