Skip to content

Commit

Permalink
Dockerfile: Optimize Docker image size
Browse files Browse the repository at this point in the history
Reduce Docker image size from 428 MB to 277 MB.

See #3674
  • Loading branch information
ellerbrock authored and anthonyfok committed Jul 23, 2017
1 parent 12e0495 commit 606d6a8
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]

0 comments on commit 606d6a8

Please sign in to comment.