Files
tianxuan-company/Dockerfile
Jowe 7fe1586dc0 feat: 添加 Docker 部署配置
- 添加 Dockerfile (多阶段构建: Node 构建 → Nginx 托管)
- 添加 docker-compose.yml (端口 8801, 自动重启)
- 添加 .dockerignore (减少构建体积)
- 添加 docker-deploy.md (部署文档)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 01:18:52 +08:00

33 lines
576 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM node:20-alpine AS builder
WORKDIR /app
# 安装 pnpm如果需要
# RUN corepack enable && corepack prepare pnpm@latest --activate
# 复制依赖文件
COPY package*.json ./
# 安装依赖
RUN npm install
# 复制源码
COPY . .
# 构建生产版本
RUN npm run build
# 运行阶段 - 使用 Nginx
FROM nginx:alpine
# 从构建阶段复制产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制 Nginx 配置(可选)
# COPY nginx.conf /etc/nginx/conf.d/default.conf
# 暴露端口
EXPOSE 80
# 启动 Nginx
CMD ["nginx", "-g", "daemon off;"]