From eed109076349bd7d6383807d8f3cda1d3eb93dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=B7=E8=BE=89?= Date: Mon, 30 Jun 2025 09:35:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0DockerFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b8fcdf4 --- /dev/null +++ b/Dockerfile @@ -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;"] \ No newline at end of file