hugo/Dockerfile
Thibault Jamet 09d960f173 Update Dockerfile to benefit build cache
Docker has recently introduces buikld-stages (as of version 17.05)

Build stages allows to benefit the docker build cache as well as
reducing the size of the resulting image c.f.
https://docs.docker.com/engine/userguide/eng-image/multistage-build/

This change allows to have faster builds when running `docker build`
several times after changing some little code

Signed-off-by: Thibault Jamet <tjamet@users.noreply.github.com>
2017-09-25 10:28:13 -06:00

23 lines
545 B
Docker

FROM golang:1.9.0-alpine3.6 AS build
RUN apk add --no-cache --virtual git musl-dev
RUN go get github.com/kardianos/govendor
RUN govendor get github.com/gohugoio/hugo
WORKDIR /go/src/github.com/gohugoio/hugo
RUN rm -f $GOPATH/bin/hugo
RUN go install -ldflags '-s -w'
FROM alpine:3.6
RUN \
adduser -h /site -s /sbin/nologin -u 1000 -D hugo && \
apk add --no-cache \
dumb-init
COPY --from=build /go/bin/hugo /bin/hugo
USER hugo
WORKDIR /site
VOLUME /site
EXPOSE 1313
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
CMD [ "--help" ]