From 6510bf606870e68b47b7e65150e69164f18e281d Mon Sep 17 00:00:00 2001 From: unclejack Date: Fri, 7 May 2021 20:55:48 +0300 Subject: [PATCH] Dockerfile: make the static binary smaller Signed-off-by: unclejack --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4669b248..f2e8a765 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,8 @@ WORKDIR /src RUN apk add --no-cache file ENV GOMODCACHE /root/.cache/gocache RUN --mount=target=. --mount=target=/root/.cache,type=cache \ - CGO_ENABLED=0 go build -o /out/dagger ./cmd/dagger && file /out/dagger | grep "statically linked" + CGO_ENABLED=0 go build -o /out/dagger -ldflags '-s -d -w' ./cmd/dagger; \ + file /out/dagger | grep "statically linked" FROM scratch COPY --from=build /out/dagger /bin/dagger