Skip to content

feat(go-api): multi-stage Dockerfile for Go API service#33

Open
Depo-dev wants to merge 1 commit into
devfrom
feat/issue-17-go-api-dockerfile
Open

feat(go-api): multi-stage Dockerfile for Go API service#33
Depo-dev wants to merge 1 commit into
devfrom
feat/issue-17-go-api-dockerfile

Conversation

@Depo-dev

@Depo-dev Depo-dev commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Multi-stage Dockerfile at services/api/Dockerfile: golang:1.22-alpine builder (module cache layer + CGO_ENABLED=0 static build) + alpine:3.19 runtime
  • Binary runs as non-root trident user, exposes port 3000
  • Adds docker-build CI job to build trident-go-api:ci with GHA cache

Test plan

  • docker build -f services/api/Dockerfile . succeeds locally
  • Final image < 30 MB
  • CI docker-build job passes on this PR

Closes #17

Multi-stage build: golang:1.22-alpine builder downloads modules then
compiles with CGO_ENABLED=0 for a fully static binary; alpine:3.19
runtime copies only the binary and runs as non-root trident user on
port 3000. Extends CI with a docker-build job that builds the Go API
image using GitHub Actions cache.
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