FROM node:alpine AS build RUN apk --no-cache add git && \ git clone https://code.modernleft.org/gravityfargo/quartz.git && \ cd quartz && git switch json-config && cd .. && \ mkdir -p /usr/share/nginx/html && \ mv quartz/* /usr/share/nginx/html && \ cd /usr/share/nginx/html && \ npm ci && npx quartz build && \ rm -rf /usr/share/nginx/html/node_modules /usr/share/nginx/html/docs FROM nginx:stable-alpine3.20 COPY --from=build /usr/share/nginx/html /usr/share/nginx/html COPY default.conf.template /etc/nginx/templates/default.conf.template COPY config.json /usr/share/nginx/html/default-config.json WORKDIR /usr/share/nginx/html RUN apk --no-cache add nodejs npm bash dumb-init git && \ rm -rf /var/cache/apk/* && \ echo "*/5 * * * * cd /usr/share/nginx/html/content && git pull >/dev/null 2>&1 && cd /usr/share/nginx/html && npx quartz build >/dev/null 2>&1" > /etc/crontabs/root RUN mkdir /config && \ ln -s /usr/share/nginx/html/content / && \ chown -R nginx:nginx /usr/share/nginx/html && \ chown -R nginx:nginx /config # REQUIRED ENV NGINX_PORT=80 ENV ENABLE_CRON="false" ENV BUILD_SCHEDULE="*/5 * * * *" ENV SERVER_NAME="quartz.zhao.xyz" ENV QUARTZ_CONFIG_PATH="/config/config.json" COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["dumb-init", "--"] CMD ["/entrypoint.sh"] LABEL org.opencontainers.image.source="https://code.modernleft.org/gravityfargo/quartz-docker" LABEL org.opencontainers.image.url="https://quartz.jzhao.xyz/" LABEL org.opencontainers.image.description="A docker image for Quartz, a static site generator." LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.authors="Nathan Price "