chore: productionize compose deployment

This commit is contained in:
Cheng Zhou
2026-03-27 16:13:28 +08:00
parent d8c5413b26
commit f2f856ea24
7 changed files with 182 additions and 79 deletions
+14
View File
@@ -0,0 +1,14 @@
FROM node:20-alpine AS frontend-build
WORKDIR /app
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
FROM nginx:1.27-alpine
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=frontend-build /app/dist /usr/share/nginx/html
+3 -10
View File
@@ -20,11 +20,8 @@ http {
sendfile on;
keepalive_timeout 65;
upstream frontend {
zone frontend 64k;
server frontend:5173 resolve;
}
root /usr/share/nginx/html;
index index.html;
upstream backend {
zone backend 64k;
@@ -62,11 +59,7 @@ http {
}
location / {
proxy_pass http://frontend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
try_files $uri $uri/ /index.html;
}
}
}