From 12b5db70e20d9dcbc811e993b46503a94de497be Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Thu, 4 Nov 2021 18:11:26 -0700 Subject: [PATCH] Dockerfile: strip binary by default Signed-off-by: Tonis Tiigi --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dd4b765d..1f258aae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,12 +24,13 @@ RUN --mount=target=. \ FROM gobase AS buildx-build ENV CGO_ENABLED=0 +ARG LDFLAGS="-w -s" ARG TARGETPLATFORM RUN --mount=type=bind,target=. \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod \ --mount=type=bind,source=/tmp/.ldflags,target=/tmp/.ldflags,from=buildx-version \ - set -x; xx-go build -ldflags "$(cat /tmp/.ldflags)" -o /usr/bin/buildx ./cmd/buildx && \ + set -x; xx-go build -ldflags "$(cat /tmp/.ldflags) ${LDFLAGS}" -o /usr/bin/buildx ./cmd/buildx && \ xx-verify --static /usr/bin/buildx FROM buildx-build AS test