feat: 增加DockerFile

This commit is contained in:
张德辉 2025-06-30 09:35:13 +08:00
parent 933d71c99d
commit eed1090763
1 changed files with 29 additions and 0 deletions

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# 构建阶段
FROM oven/bun:1.1.13-alpine AS builder
WORKDIR /app
# 拷贝依赖文件
COPY package.json bun.lock* ./
# 安装依赖
RUN bun install
# 拷贝全部源代码
COPY . .
# 构建前端
RUN bun run build
# 生产环境阶段
FROM nginx:alpine
# 拷贝构建产物到 nginx 静态目录
COPY --from=builder /app/dist /usr/share/nginx/html
# 可选:自定义 nginx 配置(如有需要)
# COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]