FROM alpine:latest as build

ENV HUGO_VERSION 0.59.1
ENV HUGO_BINARY hugo_${HUGO_VERSION}_Linux-64bit.tar.gz

# Install Hugo
RUN set -x && \
  apk add --update wget ca-certificates git && \
  wget https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} && \
  tar xzf ${HUGO_BINARY} && \
  rm -r ${HUGO_BINARY} && \
  mv hugo /usr/bin

COPY ./ /site

WORKDIR /site

RUN /usr/bin/hugo --gc --minify --enableGitInfo

FROM nginx:alpine

COPY --from=build /site/public /usr/share/nginx/html

