feat: Implement containerized deployment with frontend/backend separation
This commit is contained in:
1 parent
2b8a0010ef
commit
f18b6ce2df
5 files changed
+103
-136
No files matched your search
+9
-12
@@ -1,15 +1,12 @@
|
||||
|
||||
# frontend/Dockerfile
|
||||
# Build Stage
|
||||
FROM node:20-slim AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Production Stage
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# 复制自定义 Nginx 配置
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 复制构建好的静态资源
|
||||
# 注意:在本地先执行 npm run build,然后将 dist 目录提交或在部署脚本中生成
|
||||
COPY dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in new issue
Block a user