############## # build site # ############## ARG DEBIAN_VERSION=bookworm-slim FROM debian:${DEBIAN_VERSION} AS build ARG HUGO_VERSION ARG HUGO_FILENAME=hugo_extended_${HUGO_VERSION}_linux-amd64.deb # env setup WORKDIR /usr/local/src/hugo-site # install hugo RUN set -ex; \ \ apt-get update; apt-get install -y \ curl \ ; \ \ curl -sSL -o /tmp/hugo.deb \ "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_FILENAME}"; \ apt-get install -y /tmp/hugo.deb; \ rm -f /tmp/hugo.deb; \ \ apt-get autoremove --purge -y \ curl \ ; rm -rf /var/lib/apt/lists/*; # copy and build site COPY ./ ./ RUN hugo \ --cleanDestinationDir \ --minify \ --destination /tmp/hugo-site/html ############## # serve site # ############## FROM nginx:mainline-alpine AS production # remove default site RUN rm -rf /usr/share/nginx/html # add conf.d directory COPY tools/chores/.publish/nginx_conf.d /etc/nginx/conf.d # add built site COPY --from=build /tmp/hugo-site/html /usr/share/nginx/html