mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 15:38:22 +08:00
89d826be2 raised backend/go.mod to `go 1.26.6` and updated the three CI
workflows' version assertions, but left the Go builder image in all three
Dockerfiles pinned at 1.26.5. Since the official golang images set
GOTOOLCHAIN=local, the toolchain is not auto-downloaded and any image build
fails hard at `go mod download`.
CI does not catch this: the workflows build with actions/setup-go, not with
these Dockerfiles.
Also extend the Go-upgrade checklist in DEV_GUIDE.md, which listed only the
CI files -- that omission is why the Dockerfiles were missed.
26 lines
420 B
Docker
26 lines
420 B
Docker
FROM golang:1.26.6-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装必要的工具
|
|
RUN apk add --no-cache git
|
|
|
|
# 复制go.mod和go.sum
|
|
COPY go.mod go.sum ./
|
|
|
|
# 下载依赖
|
|
RUN go mod download
|
|
|
|
# 复制源代码
|
|
COPY . .
|
|
|
|
# 构建应用
|
|
RUN VERSION_VALUE="$(./scripts/resolve-version.sh)" && \
|
|
go build -ldflags="-s -w -X main.Version=${VERSION_VALUE}" -o main ./cmd/server/
|
|
|
|
# 暴露端口
|
|
EXPOSE 8080
|
|
|
|
# 运行应用
|
|
CMD ["./main"]
|