2026-03-07 00:45:50 +01:00
|
|
|
# Stage 1: build
|
2026-03-28 14:23:21 +01:00
|
|
|
# Use the native build platform so npm ci never runs under QEMU emulation.
|
|
|
|
|
# The build output (static HTML/JS/CSS) is platform-independent.
|
2026-04-01 14:22:45 +02:00
|
|
|
# node:20-slim (Debian/glibc) avoids lightningcss musl binary resolution issues on Alpine.
|
|
|
|
|
FROM --platform=$BUILDPLATFORM node:20-slim AS builder
|
2026-03-07 00:45:50 +01:00
|
|
|
|
2026-03-09 14:00:25 +01:00
|
|
|
ARG VITE_STANDALONE=false
|
|
|
|
|
ENV VITE_STANDALONE=$VITE_STANDALONE
|
|
|
|
|
|
2026-03-07 00:45:50 +01:00
|
|
|
WORKDIR /app
|
|
|
|
|
COPY frontend/package*.json ./
|
|
|
|
|
RUN npm ci
|
|
|
|
|
|
|
|
|
|
COPY frontend/ .
|
2026-04-19 01:21:09 +02:00
|
|
|
COPY VERSION ../VERSION
|
2026-03-07 00:45:50 +01:00
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
# Stage 2: serve
|
|
|
|
|
FROM nginx:alpine
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
|
|
2026-03-09 14:09:40 +01:00
|
|
|
# Nginx config: use standalone config (no backend proxy) or full config
|
|
|
|
|
ARG VITE_STANDALONE=false
|
2026-03-07 00:45:50 +01:00
|
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
2026-03-09 14:09:40 +01:00
|
|
|
COPY docker/nginx.standalone.conf /etc/nginx/conf.d/nginx.standalone.conf
|
|
|
|
|
RUN if [ "$VITE_STANDALONE" = "true" ]; then \
|
|
|
|
|
cp /etc/nginx/conf.d/nginx.standalone.conf /etc/nginx/conf.d/default.conf; \
|
|
|
|
|
fi && \
|
|
|
|
|
rm /etc/nginx/conf.d/nginx.standalone.conf
|
2026-03-07 00:45:50 +01:00
|
|
|
|
|
|
|
|
EXPOSE 80
|