From 843a5d07d976a50b014c361eeecfa9cf60679059 Mon Sep 17 00:00:00 2001 From: Theis Date: Sun, 10 May 2026 21:08:17 +0200 Subject: [PATCH] added webserver config and dockerfile --- frontend/Dockerfile | 19 +++++++++++++++++++ frontend/nginx.conf | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 frontend/Dockerfile create mode 100644 frontend/nginx.conf diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..3611744 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,19 @@ +FROM node:22-alpine AS builder + +WORKDIR /app + +COPY package.json package-lock.json ./ +RUN npm ci + +COPY . . +RUN npm run build + +FROM nginx:alpine AS runner + +WORKDIR /usr/share/nginx/html +COPY --from=builder /app/dist . + +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..3630a8e --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,26 @@ +server { + listen 80; + server_name _; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location = /backend { + return 301 /backend/; + } + + location /backend/ { + proxy_pass http://ca-lose-backend:8004/; + } + + location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ { + expires 1y; + access_log off; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } +} \ No newline at end of file