summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorMaik Ellerbrock <ellerbrock@users.noreply.github.com>2017-06-28 11:35:26 +0200
committerAnthony Fok <foka@debian.org>2017-06-28 03:35:26 -0600
commit118f8f7cf22d756d8a894ff93551974a806f2155 (patch)
tree6654ee823b11dd8e0373114e9e975ac79ef46878 /Dockerfile
parent56d82aa025f4d2edb1dc6315132cd7ab52df649a (diff)
Dockerfile: Update Dockerfile and add Docker optimizations
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile30
1 files changed, 21 insertions, 9 deletions
diff --git a/Dockerfile b/Dockerfile
index 67dd91209..43284e4d9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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