From 0e633bdca07d20ede7a7ae9a8d6e1eb9e01942e2 Mon Sep 17 00:00:00 2001 From: libvoid <135131094+libvoid@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:24:17 +0200 Subject: [PATCH] build: use `osusergo` `netgo` to have a truly static build in docker gcr.io/distroless/static-debian11 doesn't have glibc so we make sure to never need it at runtime --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4dad3833..516629e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.20 as builder WORKDIR /go/src/sshportal COPY . ./ -RUN go build -ldflags="-X main.GitSha=$(git rev-parse --short HEAD) -X main.GitTag=$(git describe --tags --always) -extldflags '-static' -w -s" -tags sqlite_omit_load_extension -v -o /go/bin/sshportal +RUN go build -ldflags="-X main.GitSha=$(git rev-parse --short HEAD) -X main.GitTag=$(git describe --tags --always) -extldflags '-static' -w -s" -tags osusergo,netgo,sqlite_omit_load_extension -v -o /go/bin/sshportal # minimal runtime # https://github.com/GoogleContainerTools/distroless/blob/main/base/README.md