Distroless image
A distroless image contains only the minimal runtime components needed to execute an application, without a conventional shell, package manager, or unnecessary system utilities. This course uses gcr.io/distroless/static:nonroot to run statically linked Go binaries with a smaller runtime attack surface.
Minimal example
FROM gcr.io/distroless/static:nonroot
COPY --from=builder /out/api /api
USER nonroot:nonroot
EXPOSE 8080 9090
ENTRYPOINT ["/api"]