From a042f74a884861053a26a42ddc769d7abb0ddf56 Mon Sep 17 00:00:00 2001 From: Monis Khan Date: Wed, 3 Nov 2021 10:26:13 -0400 Subject: [PATCH] Dockerfile: build all files and trim file system paths Use "..." instead of "main.go" as the build target since we may have extra files in the future. https://pkg.go.dev/cmd/go#hdr-Compile_packages_and_dependencies -trimpath remove all file system paths from the resulting executable. Instead of absolute file system paths, the recorded file names will begin with either "go" (for the standard library), or a module path@version (when using modules), or a plain import path (when using GOPATH). Signed-off-by: Monis Khan --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 50b71620..1cd0e102 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,8 @@ RUN \ --mount=type=cache,target=/cache/gomodcache \ mkdir out && \ export GOCACHE=/cache/gocache GOMODCACHE=/cache/gomodcache CGO_ENABLED=0 GOOS=linux GOARCH=amd64 && \ - go build -v -ldflags "$(hack/get-ldflags.sh) -w -s" -o /usr/local/bin/pinniped-concierge-kube-cert-agent ./cmd/pinniped-concierge-kube-cert-agent/main.go && \ - go build -v -ldflags "$(hack/get-ldflags.sh) -w -s" -o /usr/local/bin/pinniped-server ./cmd/pinniped-server/main.go && \ + go build -v -trimpath -ldflags "$(hack/get-ldflags.sh) -w -s" -o /usr/local/bin/pinniped-concierge-kube-cert-agent ./cmd/pinniped-concierge-kube-cert-agent/... && \ + go build -v -trimpath -ldflags "$(hack/get-ldflags.sh) -w -s" -o /usr/local/bin/pinniped-server ./cmd/pinniped-server/... && \ ln -s /usr/local/bin/pinniped-server /usr/local/bin/pinniped-concierge && \ ln -s /usr/local/bin/pinniped-server /usr/local/bin/pinniped-supervisor && \ ln -s /usr/local/bin/pinniped-server /usr/local/bin/local-user-authenticator