From 9ed48c1c9ae4cd9390f5ef88c8b2b6624e9e247d Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Wed, 26 Jul 2017 03:22:39 -0600 Subject: [PATCH] Dockerfile: Run go install with -ldflags '-s -w' This reduce the Docker image size from 27 MB to 20.5 MB. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4d6ca2db..f8ec73a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,8 @@ RUN \ go get github.com/kardianos/govendor && \ govendor get github.com/gohugoio/hugo && \ cd $GOPATH/src/github.com/gohugoio/hugo && \ - go install && \ + rm -f $GOPATH/bin/hugo && \ + go install -ldflags '-s -w' && \ cd $GOPATH && \ rm -rf pkg src .cache bin/govendor && \ apk del .build-deps