From 46acc0834ca8744bf1cf8c50bbe6d9d254541057 Mon Sep 17 00:00:00 2001 From: Egor Gavrilov Date: Tue, 3 Sep 2024 10:15:49 +0300 Subject: [PATCH] chore: use scratch image for Dockerfile instead of distroless (#226) * Use Google Distroless for compact images, and some refactoring of Dockerfile * Use "scratch" image instead of Distroless, and some additional optimizations in Dockerfile --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4ce5bc9..27dc6e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ -FROM golang:alpine as builder +FROM golang:alpine AS builder WORKDIR /go -RUN go install github.com/xvzc/SpoofDPI/cmd/spoofdpi@latest +RUN go install -ldflags '-w -s -extldflags "-static"' -tags timetzdata github.com/xvzc/SpoofDPI/cmd/spoofdpi@latest -FROM gcr.io/distroless/static-debian12 +FROM scratch +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /go/bin/spoofdpi / ENTRYPOINT ["/spoofdpi"]