Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(dockerfile): xtrem awesome container size optimization #3738

Merged
merged 4 commits into from
Jul 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
FROM golang:alpine3.6
FROM alpine:3.6

ENV GOPATH /go
ENV PATH $GOPATH/bin:$PATH

RUN \
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
apk add --no-cache \
dumb-init \
dumb-init && \
apk add --no-cache --virtual .build-deps \
gcc \
musl-dev \
go \
git && \
mkdir -p \
${GOPATH}/bin \
${GOPATH}/pkg \
${GOPATH}/src && \
go get github.com/kardianos/govendor && \
govendor get github.com/gohugoio/hugo && \
cd $GOPATH/src/github.com/gohugoio/hugo && \
go install && \
cd $GOPATH && \
rm -rf pkg src .cache bin/govendor && \
apk del --no-cache git go
apk del .build-deps

USER hugo
WORKDIR /site
Expand All @@ -22,4 +31,3 @@ EXPOSE 1313

ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
CMD [ "--help" ]