Files
backend_v2/Dockerfile.prebuilt
toom1996 2e76507d37 deploy: 本地预构建发布(push-build),对齐 1Panel 与 backend_v2 目录
- 新增 Dockerfile.prebuilt / scripts/push-build.sh:本机构建、只上传产物,服务器零编译
- deploy.sh 增加 --prebuilt(自动 --no-pull + 产物校验),并保留 --no-cache
- compose 支持 BACKEND_DOCKERFILE / WEB_DOCKERFILE 切换;预构建时用 prebuilt 变体
- init-db.sh / scripts/backup-db.sh 改为 docker exec 1Panel 的 Postgres 容器
- WEB_DIR 默认改为 ../frontend_v2;nginx 切换文件改到 .deploy/ 避免弄脏工作区
- 新增 .gitattributes 固定脚本与配置为 LF
2026-10-21 00:02:18 +08:00

25 lines
774 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.

# 预构建镜像:二进制在本机(GOOS=linux)编好,服务器只负责打层。
# 用途:服务器资源紧张时,跳过容器内的 go build。
# 由 scripts/push-build.sh 与 deploy.sh --prebuilt 使用;构建上下文里的
# server-linux-amd64 由本机交叉编译产出(已在 .gitignore / .dockerignore 中)。
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY server-linux-amd64 /app/server
COPY configs ./configs
RUN mkdir -p /app/uploads
ENV CONFIG_PATH=/app/configs/config.yml \
GIN_MODE=release \
UPLOAD_DIR=/app/uploads
EXPOSE 8090 8091 8092
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD wget -qO- http://127.0.0.1:8090/api/health || exit 1
CMD ["/app/server"]