Dockerfile: Run go install with -ldflags '-s -w'
authorAnthony Fok <foka@debian.org>
Wed, 26 Jul 2017 09:22:39 +0000 (03:22 -0600)
committerAnthony Fok <foka@debian.org>
Wed, 26 Jul 2017 09:22:39 +0000 (03:22 -0600)
This reduce the Docker image size from 27 MB to 20.5 MB.

Dockerfile

index 4d6ca2db6f9868b4a28f02edd0309cbfbacff42f..f8ec73a8671c0a43df27cc5364ea7ad931b01cb6 100644 (file)
@@ -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