From b3bc4269f5c50ed6747a42129ea9bcea12c07322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 18 Jun 2026 23:00:08 +0300 Subject: [PATCH] Feature: base docker image on distroless debian13, nonroot Shaves off 14MB (a third) of the image size, gets rid of unnecessary distro features. There doesn't appear to be a reason to run the daemon as root in the container either, so go with the nonroot variant. https://github.com/GoogleContainerTools/distroless#why-should-i-use-distroless-images --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 810c83e36..5d898e1d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN apk upgrade && apk add git npm && \ npm ci && npm run package && \ CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/axllent/mailpit/config.Version=${VERSION}" -o /mailpit -FROM alpine:latest +FROM gcr.io/distroless/static-debian13:nonroot LABEL org.opencontainers.image.title="Mailpit" \ org.opencontainers.image.description="An email and SMTP testing tool with API for developers" \ @@ -21,8 +21,6 @@ LABEL org.opencontainers.image.title="Mailpit" \ COPY --from=builder /mailpit /mailpit -RUN apk upgrade --no-cache && apk add --no-cache tzdata - EXPOSE 1025/tcp 1110/tcp 8025/tcp HEALTHCHECK --interval=15s --start-period=10s --start-interval=1s CMD ["/mailpit", "readyz"]