From cbfcbbb88054dd52a8881ed9fd3ecdbb1abd9d4f Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Mon, 4 Sep 2017 09:03:43 +0100 Subject: [PATCH] Strip binaries to half of size Signed-off-by: Alex Ellis --- watchdog/Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/watchdog/Dockerfile b/watchdog/Dockerfile index 1fb53bb7..e6facbbe 100644 --- a/watchdog/Dockerfile +++ b/watchdog/Dockerfile @@ -12,6 +12,7 @@ COPY types types RUN go test -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog . \ - && GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o watchdog-armhf . \ - && GOOS=windows CGO_ENABLED=0 go build -a -installsuffix cgo -o watchdog.exe . +# Stripping via -ldflags "-s -w" +RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-s -w" -installsuffix cgo -o watchdog . \ + && GOARM=6 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-s -w" -installsuffix cgo -o watchdog-armhf . \ + && GOOS=windows CGO_ENABLED=0 go build -a -ldflags "-s -w" -installsuffix cgo -o watchdog.exe .