Files
dusuniot/Dockerfile
T
bigcode c3df5d9db1 v0.15.0: Docker 化部署(OVH-US-BAK)
- Dockerfile(oven/bun 多阶段:构建 dist + 全量 node_modules 运行时)
- deploy/docker-compose.yml(postgres:18 + app,uploads 双挂载同宿主目录)
- .dockerignore(uploads 经卷挂载不进镜像,避免 3GB 膨胀)
- prod-server /uploads/* 运行时直读磁盘(媒体上传后无需重启即可访问,含路径穿越防护)
- README Docker 部署章节
2026-11-04 15:15:58 +08:00

21 lines
757 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.
# 构建阶段:bun 安装依赖并产出 dist(vite build)
FROM oven/bun:1-slim AS build
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
# 运行阶段:产物 + 全量 node_modules(dist/server 对 react/@tanstack/seroval 等是裸导入)
FROM oven/bun:1-slim
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --from=build /app/public ./public
COPY --from=build /app/scripts ./scripts
COPY --from=build /app/package.json ./package.json
# public/uploads 由部署侧卷挂载提供(写入与 /uploads 访问同一宿主目录,见 deploy/docker-compose.yml)
EXPOSE 3312
CMD ["bun", "scripts/prod-server.ts"]