Skip to content

fix: update backend/Dockerfile to Go 1.26.1 with multi-stage build#1273

Open
thuanpham582002 wants to merge 1 commit intoWei-Shaw:mainfrom
thuanpham582002:fix/backend-dockerfile-go-version
Open

fix: update backend/Dockerfile to Go 1.26.1 with multi-stage build#1273
thuanpham582002 wants to merge 1 commit intoWei-Shaw:mainfrom
thuanpham582002:fix/backend-dockerfile-go-version

Conversation

@thuanpham582002
Copy link

Summary

  • Update Go version from 1.25.7 to 1.26.1 to match go.mod and CI requirements
  • Modernize with multi-stage build (builder + alpine 3.21 runtime) for smaller image
  • Add non-root user (sub2api, uid/gid 1000), healthcheck, and OCI labels
  • Use CGO_ENABLED=0, -trimpath, -ldflags="-s -w" for a static, smaller binary
  • Align conventions with root Dockerfile

Test plan

  • Verify Dockerfile syntax is valid
  • Build the image: docker build -f backend/Dockerfile backend/
  • Confirm the container runs as non-root user
  • Confirm healthcheck endpoint responds

- Update Go version from 1.25.7 to 1.26.1 to match go.mod and CI
- Add multi-stage build (builder + alpine runtime) for smaller image
- Add non-root user (sub2api, uid/gid 1000)
- Add healthcheck, labels, and CGO_ENABLED=0 for static binary
- Use -trimpath -ldflags="-s -w" for smaller binary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant