Files
NianAIGC/.project-docs/30-worklog/tasks/20260814-alpine-only-build-3b8e5a6d.md
T

1.4 KiB

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: d82e7a104e
  • 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.