mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
9ed48c1c9a
This reduce the Docker image size from 27 MB to 20.5 MB.
34 lines
737 B
Docker
34 lines
737 B
Docker
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 && \
|
|
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 && \
|
|
rm -f $GOPATH/bin/hugo && \
|
|
go install -ldflags '-s -w' && \
|
|
cd $GOPATH && \
|
|
rm -rf pkg src .cache bin/govendor && \
|
|
apk del .build-deps
|
|
|
|
USER hugo
|
|
WORKDIR /site
|
|
VOLUME /site
|
|
EXPOSE 1313
|
|
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--", "hugo"]
|
|
CMD [ "--help" ]
|