FROM ghcr.io/hugomods/hugo:0.128.2 AS build
ARG GH_ACCESS_TOKEN
WORKDIR /tmp/hugo
COPY . .
RUN apk add --no-cache make && git config --global url.https://${GH_ACCESS_TOKEN}@github.com/.insteadOf https://github.com/ && make build

FROM nginx:alpine-slim
WORKDIR  /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /tmp/hugo/public .
EXPOSE 80/tcp
