feat: 增加DockerFile
This commit is contained in:
parent
933d71c99d
commit
eed1090763
|
|
@ -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;"]
|
||||
Loading…
Reference in New Issue