build: add self-contained alpine-only Go image build

This commit is contained in:
zn-admin committed 2026-08-15 14:26:32 +08:00
1 parent d82e7a104e
commit 9f40162c6b
4 files changed
+83 -1

No files matched your search

@@ -0,0 +1,38 @@
# Task: Add self-contained alpine-only Go image build
## Identity
- Task ID: 20260814-alpine-only-build-3b8e5a6d
- Mode: Feature
- Branch: main
- Worktree: /Users/brother7/Documents/AI/NianAIGC
- Base commit: d82e7a104e84e0d6161adbda5339a6ad27088b91
- Owner: dsh
- Status: Ready for Integration
## Scope
- Provide a single-command docker build for the Go image that pulls only the alpine base image: the Go toolchain is installed from Alpine's package repositories (aliyun apk mirror) and module downloads use goproxy.cn, so no golang builder image and no external dockerfile frontend are needed.
## Intent And Constraints
- Runtime stage identical to the existing images (non-root uid/gid 10001, ca-certificates, tzdata).
- Build-stage network dependencies are all China-accessible (aliyun apk mirror, goproxy.cn, sum.golang.google.cn).
## Outcome
- Added `backend/Dockerfile.alpine` with a self-contained two-stage build.
- Documented it as the recommended build in `backend/README.md` and `docs/DEPLOYMENT.md`.
## Verification
- Dockerfile static review; the compile step is the same `CGO_ENABLED=0 go build` already verified locally (12.3 MB static ELF).
- Actual image build must run on the CI machine: `docker build -f backend/Dockerfile.alpine -t REGISTRY/PROJECT/zhinian-go-api:TAG backend/`.
## Follow-ups
- Re-run the CI build with the new one-command path.
## Promotion Candidates
- None.