Created
January 31, 2020 05:35
-
-
Save aaronhurt/3c7f3c65cd1f94ba3c6758f1f8e9786e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FROM alpine:latest AS build | |
ARG hugo_version=0.62.2 | |
## fetch and install hugo | |
RUN wget -q -O - \ | |
https://github.com/gohugoio/hugo/releases/download/v${hugo_version}/hugo_${hugo_version}_Linux-64bit.tar.gz \ | |
| tar -zxf - hugo && \ | |
mv hugo /usr/local/bin/hugo && \ | |
chmod 0755 /usr/local/bin/hugo | |
## generate static content | |
COPY docs /opt/docs | |
WORKDIR /opt/docs | |
RUN /usr/local/bin/hugo --buildDrafts --cleanDestinationDir --destination /opt/output | |
FROM alpine:latest | |
## install thttpd (http://acme.com/software/thttpd/) | |
RUN apk add --no-cache thttpd | |
## copy static assets form build | |
COPY --from=build /opt/output /var/www/http | |
## use package user | |
USER thttpd | |
EXPOSE 1180 | |
## launch thttpd to serve static content | |
ENTRYPOINT ["/usr/sbin/thttpd"] | |
CMD ["-p", "1180", "-d", "/var/www/http", "-l", "/dev/stdout", "-D"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment