Skip to content

Commit

Permalink
build: use osusergo netgo to have a truly static build in docker
Browse files Browse the repository at this point in the history
gcr.io/distroless/static-debian11 doesn't have glibc so we make sure to never need it at runtime
  • Loading branch information
libvoid committed Aug 8, 2023
1 parent 6a775ce commit 0e633bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e633bd

Please sign in to comment.