# 默认：只复制本机/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

WORKDIR /app
ENV PORT=8080
ENV DATA_DIR=/data

COPY dist/sproutgate-backend /usr/local/bin/sproutgate-backend

EXPOSE 8080
VOLUME ["/data"]

ENTRYPOINT ["sproutgate-backend"]
