diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 0a0c7ce..c937433 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine AS build +FROM node:22-alpine AS build WORKDIR /app COPY package.json . RUN npm install @@ -8,6 +8,6 @@ ENV VITE_HOTEL_NAME=$VITE_HOTEL_NAME RUN npm run build FROM nginx:alpine -COPY --from=build /app/dist /usr/share/nginx/html +COPY --from=build /app/dist /usr/share/nginx/html/room-planner COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 185c71a..46afaac 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -1,10 +1,7 @@ server { listen 80; - - location /room-planner/ { - alias /usr/share/nginx/html/; - try_files $uri $uri/ /room-planner/index.html; - } + server_name localhost; + root /usr/share/nginx/html; location /room-planner/api/auth/ { proxy_pass http://10.10.10.101:3001/api/auth/; @@ -18,6 +15,7 @@ server { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + add_header Cache-Control "no-store"; # SSE support proxy_buffering off; proxy_cache off; @@ -27,4 +25,19 @@ server { location /room-planner/health { proxy_pass http://backend:3001/health; } + + location ~* /room-planner/.*\.(js|css|png|ico|svg|woff2?)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + location /room-planner/ { + add_header Cache-Control "no-cache" always; + try_files $uri $uri/ /room-planner/index.html; + } + + location = / { + return 301 /room-planner/; + } }