fix: vite server hotfix

This commit is contained in:
2026-06-16 12:15:25 +03:00
parent 1022b7e5f1
commit 9df80dd4e1
6 changed files with 146 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
FROM node:20-alpine
# Stage 1: build
FROM node:20-alpine AS builder
WORKDIR /app
@@ -6,5 +7,12 @@ COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
CMD ["npm", "run", "dev"]
# Stage 2: serve with nginx
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.prod.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

17
frontend/nginx.prod.conf Normal file
View File

@@ -0,0 +1,17 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
# SPA fallback — all unknown routes serve index.html
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|svg|ico|woff2?)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}