Skip to content

Commit 606d6a8

Browse files
ellerbrockanthonyfok
authored andcommitted
Dockerfile: Optimize Docker image size
Reduce Docker image size from 428 MB to 277 MB. See #3674
1 parent 12e0495 commit 606d6a8

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

‎Dockerfile‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ ENV GOPATH /go
44

55
RUN \
66
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
7-
apk add --no-cache dumb-init && \
8-
apk add --no-cache --virtual .build-deps \
9-
git \
10-
make && \
7+
apk add --no-cache \
8+
dumb-init \
9+
git && \
1110
go get github.com/kardianos/govendor && \
1211
govendor get github.com/gohugoio/hugo && \
1312
cd $GOPATH/src/github.com/gohugoio/hugo && \
14-
make install test && \
15-
rm -rf $GOPATH/src/* && \
16-
apk del .build-deps
17-
18-
USER hugo
13+
go install && \
14+
cd $GOPATH && \
15+
rm -rf pkg src .cache bin/govendor && \
16+
apk del --no-cache git go
1917

18+
USER hugo
2019
WORKDIR /site
21-
22-
EXPOSE 1313
20+
VOLUME /site
21+
EXPOSE 1313
2322

2423
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
25-
2624
CMD [ "--help" ]
2725

0 commit comments

Comments
 (0)