-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile: Update Dockerfile and add Docker optimizations
- Loading branch information
1 parent
56d82aa
commit 118f8f7
Showing
1 changed file
with
21 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
FROM golang:1.8-alpine | ||
FROM golang:alpine3.6 | ||
|
||
ENV GOPATH /go | ||
ENV USER root | ||
|
||
RUN apk update && apk add git make | ||
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 && \ | ||
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 | ||
|
||
# pre-install known dependencies before the source, so we don't redownload them whenever the source changes | ||
RUN go get github.com/kardianos/govendor \ | ||
&& govendor get github.com/gohugoio/hugo | ||
USER hugo | ||
|
||
COPY . $GOPATH/src/github.com/gohugoio/hugo | ||
WORKDIR /site | ||
|
||
EXPOSE 1313 | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"] | ||
|
||
CMD [ "--help" ] | ||
|
||
RUN cd $GOPATH/src/github.com/gohugoio/hugo \ | ||
&& make install test |