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

feat(docker): hugo from scratch + dockhub & quay account #4155

Closed
wants to merge 2 commits into from
Closed
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
40 changes: 25 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
FROM golang:1.9.0-alpine3.6 AS build
# GitHub: https://github.com/gohugoio/
# DockerHub: https://hub.docker.com/r/gohugoio/
# Quay: https://quay.io/user/gohugoio
# Twitter: https://twitter.com/gohugoio
# Website: https://gohugo.io/

RUN apk add --no-cache --virtual git musl-dev
RUN go get github.com/golang/dep/cmd/dep
FROM golang:1.10-rc-alpine3.7 AS build

WORKDIR /go/src/github.com/gohugoio/hugo
RUN dep ensure
ADD . /go/src/github.com/gohugoio/hugo/
RUN go install -ldflags '-s -w'
ENV CGO_ENABLED=0
ENV GOOS=linux

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
git \
musl-dev && \
go get github.com/golang/dep/cmd/dep && \
go get github.com/kardianos/govendor && \
govendor get github.com/gohugoio/hugo && \
cd /go/src/github.com/gohugoio/hugo && \
dep ensure && \
go install -ldflags '-s -w'

# ---

FROM scratch

COPY --from=build /go/bin/hugo /hugo

EXPOSE 1313

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