Update SproutGate

This commit is contained in:
2026-05-13 12:19:36 +08:00
parent f7db8aa053
commit a37b92e144
51 changed files with 12034 additions and 254 deletions

View File

@@ -1,11 +1,9 @@
FROM golang:1.20-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/sproutgate-backend .
# 默认:只复制本机/CI 已构建的 Linux amd64 二进制,不在镜像里执行 go build
# 1) 在 sproutgate-backend 目录执行: build-linux-amd64.bat
# 或: set CGO_ENABLED=0&& set GOOS=linux&& set GOARCH=amd64&& go build -trimpath -ldflags="-s -w" -o dist\sproutgate-backend .
# 2) 再: docker compose build
#
# 若必须在 Docker 里从源码编译,请用: docker build -f Dockerfile.build -t ... .
FROM alpine:3.19
RUN apk add --no-cache ca-certificates tzdata
@@ -14,8 +12,7 @@ WORKDIR /app
ENV PORT=8080
ENV DATA_DIR=/data
COPY --from=builder /out/sproutgate-backend /usr/local/bin/sproutgate-backend
COPY API_DOCS.md /app/API_DOCS.md
COPY dist/sproutgate-backend /usr/local/bin/sproutgate-backend
EXPOSE 8080
VOLUME ["/data"]