deploy: route frontend and core through one origin

This commit is contained in:
2026-08-04 15:48:15 +02:00
parent fe5c428354
commit 8ffcaf3db9
10 changed files with 109 additions and 127 deletions
+5 -9
View File
@@ -1,21 +1,17 @@
# syntax=docker/dockerfile:1.7
# thothii-frontend: build Vite (React) + nginx-unprivileged (porta 8080).
# Build args:
# VITE_BASE prefisso asset ("/" standalone, "/datamart-builder/assets/" embedded)
# VITE_BACKEND_URL base API ("http://localhost:8787" standalone, "/datamart-builder/api" embedded)
FROM node:22-bookworm AS build
WORKDIR /src
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
ARG VITE_BASE=/
ARG VITE_BACKEND_URL=http://localhost:8787
ENV VITE_BASE=$VITE_BASE VITE_BACKEND_URL=$VITE_BACKEND_URL
ENV VITE_BASE=/ VITE_BACKEND_URL=/api
RUN npm run build
# typecheck opzionale (non bloccante nella build dell'immagine)
RUN npx tsc -b 2>/dev/null || true
FROM nginxinc/nginx-unprivileged:1.27-alpine AS runtime
COPY --from=build /src/dist /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY docker/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --chmod=755 docker/frontend-entrypoint.sh /usr/local/bin/frontend-entrypoint
ENTRYPOINT ["/usr/local/bin/frontend-entrypoint"]
CMD ["nginx", "-g", "daemon off;"]
EXPOSE 8080