From 8a192578fa09e9a0eeef0acbe531f0d27e40fd37 Mon Sep 17 00:00:00 2001 From: Edwin van den Houdt Date: Fri, 31 Jul 2026 09:13:08 +0200 Subject: [PATCH] build(portal-frontend): add Dockerfile and SPA nginx config Multi-stage: node build with --base-href=/portal/, then nginx:alpine serving the compiled dist with try_files SPA fallback for client-side routes (e.g. a direct hit on /legacy/1001). Verified standalone: root and a deep link both 200, base href correct. --- portal-frontend/Dockerfile | 11 +++++++++++ portal-frontend/nginx.conf | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 portal-frontend/Dockerfile create mode 100644 portal-frontend/nginx.conf diff --git a/portal-frontend/Dockerfile b/portal-frontend/Dockerfile new file mode 100644 index 0000000..6d87b37 --- /dev/null +++ b/portal-frontend/Dockerfile @@ -0,0 +1,11 @@ +FROM node:22-alpine AS build +WORKDIR /src +COPY package.json package-lock.json ./ +RUN npm ci +COPY . . +RUN npx ng build --configuration production --base-href=/portal/ + +FROM nginx:alpine AS runtime +COPY --from=build /src/dist/portal-frontend/browser /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/portal-frontend/nginx.conf b/portal-frontend/nginx.conf new file mode 100644 index 0000000..c66ea4b --- /dev/null +++ b/portal-frontend/nginx.conf @@ -0,0 +1,8 @@ +server { + listen 80; + root /usr/share/nginx/html; + + location / { + try_files $uri $uri/ /index.html; + } +}