mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Dockerfile: Optimize Docker image size
Reduce Docker image size from 428 MB to 277 MB. See #3674
This commit is contained in:
parent
12e0495203
commit
606d6a8c91
1 changed files with 10 additions and 12 deletions
22
Dockerfile
22
Dockerfile
|
@ -4,24 +4,22 @@ ENV GOPATH /go
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
|
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
|
||||||
apk add --no-cache dumb-init && \
|
apk add --no-cache \
|
||||||
apk add --no-cache --virtual .build-deps \
|
dumb-init \
|
||||||
git \
|
git && \
|
||||||
make && \
|
|
||||||
go get github.com/kardianos/govendor && \
|
go get github.com/kardianos/govendor && \
|
||||||
govendor get github.com/gohugoio/hugo && \
|
govendor get github.com/gohugoio/hugo && \
|
||||||
cd $GOPATH/src/github.com/gohugoio/hugo && \
|
cd $GOPATH/src/github.com/gohugoio/hugo && \
|
||||||
make install test && \
|
go install && \
|
||||||
rm -rf $GOPATH/src/* && \
|
cd $GOPATH && \
|
||||||
apk del .build-deps
|
rm -rf pkg src .cache bin/govendor && \
|
||||||
|
apk del --no-cache git go
|
||||||
USER hugo
|
|
||||||
|
|
||||||
|
USER hugo
|
||||||
WORKDIR /site
|
WORKDIR /site
|
||||||
|
VOLUME /site
|
||||||
EXPOSE 1313
|
EXPOSE 1313
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
|
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
|
||||||
|
|
||||||
CMD [ "--help" ]
|
CMD [ "--help" ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue