summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaik Ellerbrock <[email protected]>2017-07-23 20:30:18 +0200
committerAnthony Fok <[email protected]>2017-07-23 12:30:18 -0600
commit606d6a8c9177dda4551ed198e0aabbe569f0725d (patch)
tree76d7bbc8103203c4ff79c6a27ce8c2a9eedb14e8
parent12e0495203d2aa0b37101eb3c12ed4ccd6d37b6c (diff)
downloadhugo-606d6a8c9177dda4551ed198e0aabbe569f0725d.tar.gz
hugo-606d6a8c9177dda4551ed198e0aabbe569f0725d.zip
Dockerfile: Optimize Docker image size
Reduce Docker image size from 428 MB to 277 MB. See #3674
-rw-r--r--Dockerfile22
1 files changed, 10 insertions, 12 deletions
diff --git a/Dockerfile b/Dockerfile
index 43284e4d9..386fb09f1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,24 +4,22 @@ ENV GOPATH /go
RUN \
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
- apk add --no-cache dumb-init && \
- apk add --no-cache --virtual .build-deps \
- git \
- make && \
+ apk add --no-cache \
+ dumb-init \
+ git && \
go get github.com/kardianos/govendor && \
govendor get github.com/gohugoio/hugo && \
cd $GOPATH/src/github.com/gohugoio/hugo && \
- make install test && \
- rm -rf $GOPATH/src/* && \
- apk del .build-deps
-
-USER hugo
+ go install && \
+ cd $GOPATH && \
+ rm -rf pkg src .cache bin/govendor && \
+ apk del --no-cache git go
+USER hugo
WORKDIR /site
-
-EXPOSE 1313
+VOLUME /site
+EXPOSE 1313
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
-
CMD [ "--help" ]