Skip to content

Instantly share code, notes, and snippets.

@h3ct0rjs
Created June 20, 2021 19:43
Show Gist options
  • Save h3ct0rjs/f71020a10d6cfd945d112eadd4c65943 to your computer and use it in GitHub Desktop.
Save h3ct0rjs/f71020a10d6cfd945d112eadd4c65943 to your computer and use it in GitHub Desktop.
Hugo website. e
FROM alpine as HUGO
ENV HUGO_VERSION="0.81.0"
RUN apk add --update wget
# Install Hugo.
RUN wget --quiet https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \
tar -xf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \
mv hugo /usr/local/bin/hugo && \
rm -rf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
COPY . /hugo-site
# Use Hugo to build the static site files.
RUN hugo -v --source=/hugo-site --destination=/hugo-site/public
FROM bitnami/nginx:latest
COPY --from=HUGO /hugo-site/public/ /opt/bitnami/nginx/html/
# The container will listen on port 8080 (non-privileged) using the TCP protocol.
EXPOSE 8080
@h3ct0rjs
Copy link
Author

docker build -t hugo-site:v1 .

@h3ct0rjs
Copy link
Author

docker run -d --rm --name hugo -p 8080:8080 hugo-site:v1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment