From 4af1d1f825f7e68c4aab4001d1fa04ba748c2223 Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Fri, 9 Aug 2024 03:23:45 +0530 Subject: [PATCH] using distroless Signed-off-by: Arnav Gupta --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6cc10ea..e74c400 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,9 @@ FROM golang:1.22 AS builder # Install CA certificates RUN apt-get update && apt-get install -y ca-certificates + # Move to working directory (/build). +RUN mkdir /build WORKDIR /build # Copy and download dependency using go mod. @@ -18,7 +20,7 @@ ENV CGO_ENABLED=1 GOOS=linux GOARCH=amd64 # RUN go build -ldflags="-s -w" -o onepixel ./src/main.go RUN make build DOCS=false -FROM scratch +FROM gcr.io/distroless/static-debian12 LABEL maintainer="Arnav Gupta (https://arnav.tech)" LABEL description="OnePixel is a simple, self-hosted, one pixel web analytics tool" @@ -31,4 +33,4 @@ COPY --from=builder ["/build/bin/onepixel", "/"] COPY --from=builder ["/build/public_html", "/public_html"] # Command to run when starting the container. -ENTRYPOINT ["/onepixel"] \ No newline at end of file +CMD ["/onepixel"] \ No newline at end of file