2021-12-27 21:04:33 +01:00
|
|
|
FROM alpine:latest AS builder
|
2021-12-05 16:45:50 +01:00
|
|
|
ARG WEBSITE_ARCHIVE_URL
|
|
|
|
ARG WEBSITE_ARCHIVE_FOLDER
|
2022-02-22 12:18:04 +01:00
|
|
|
ARG WEBSITE_HOST
|
2021-12-05 16:45:50 +01:00
|
|
|
|
2024-06-05 18:34:16 +02:00
|
|
|
RUN apk update
|
|
|
|
RUN apk upgrade
|
|
|
|
RUN set -eux
|
|
|
|
RUN apk add tar gzip curl
|
|
|
|
RUN apk add zola --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
|
2021-12-05 16:45:50 +01:00
|
|
|
|
|
|
|
COPY archive-token.txt /archive-token.txt
|
2024-06-05 18:34:16 +02:00
|
|
|
RUN curl -X "GET" -H "Authorization: token $(cat /archive-token.txt)" "$WEBSITE_ARCHIVE_URL" | gzip --decompress --stdout - | tar xf -
|
|
|
|
RUN rm /archive-token.txt
|
2021-12-05 16:45:50 +01:00
|
|
|
|
2021-12-27 21:04:33 +01:00
|
|
|
WORKDIR /$WEBSITE_ARCHIVE_FOLDER
|
2024-06-05 18:34:16 +02:00
|
|
|
RUN zola build
|
|
|
|
RUN rm public/404.html
|
2021-12-05 16:45:50 +01:00
|
|
|
|
2024-06-05 17:08:21 +02:00
|
|
|
RUN wget -O /tmp/Caddyfile "https://git.jotoho.de/jotoho/site-deployer/raw/branch/master/$WEBSITE_HOST/Caddyfile" >/dev/null 2>&1
|
2022-02-22 12:18:04 +01:00
|
|
|
|
2021-12-27 21:04:33 +01:00
|
|
|
FROM caddy:2
|
|
|
|
ARG WEBSITE_ARCHIVE_FOLDER
|
|
|
|
|
|
|
|
COPY --from=builder /$WEBSITE_ARCHIVE_FOLDER/public /site
|
2022-02-22 12:18:04 +01:00
|
|
|
COPY --from=builder /tmp/Caddyfile ./
|
2021-12-27 21:04:33 +01:00
|
|
|
|
2021-12-05 16:45:50 +01:00
|
|
|
EXPOSE 80/tcp
|
|
|
|
|
2022-02-22 12:22:13 +01:00
|
|
|
CMD ["caddy", "run", "--config", "./Caddyfile"]
|