Created
May 26, 2026 19:58
-
-
Save copyleftdev/10f272a6623c1ef96655e779e98f45ef to your computer and use it in GitHub Desktop.
micro-containers: distroless OCI Dockerfile — same image for runc, gVisor, Kata, Firecracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # OCI image — works with runc, gVisor (runsc), Kata (QEMU), and Kata (Firecracker). | |
| # The runtime is injected via RUNTIME_NAME at `docker run` time. | |
| # Build: docker build -t micro-containers . | |
| FROM golang:1.24-alpine AS builder | |
| WORKDIR /src | |
| COPY go.mod ./ | |
| RUN go mod download | |
| COPY cmd/server/ ./cmd/server/ | |
| RUN CGO_ENABLED=0 GOOS=linux go build \ | |
| -ldflags="-w -s" \ | |
| -o /server \ | |
| ./cmd/server/ | |
| # distroless/static has no shell, no libc — just the binary + CA certs. | |
| # Image size: ~5 MB vs ~50 MB for Alpine. | |
| FROM gcr.io/distroless/static-debian12:nonroot | |
| COPY --from=builder /server /server | |
| EXPOSE 8080 | |
| ENTRYPOINT ["/server"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment