1
0
Fork 0
site-deployer/Dockerfile

30 lines
861 B
Docker

FROM alpine:latest AS builder
ARG WEBSITE_ARCHIVE_URL
ARG WEBSITE_ARCHIVE_FOLDER
ARG WEBSITE_HOST
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/
COPY archive-token.txt /archive-token.txt
RUN curl -X "GET" -H "Authorization: token $(cat /archive-token.txt)" "$WEBSITE_ARCHIVE_URL" | gzip --decompress --stdout - | tar xf -
RUN rm /archive-token.txt
WORKDIR /$WEBSITE_ARCHIVE_FOLDER
RUN zola build
RUN rm public/404.html
RUN wget -O /tmp/Caddyfile "https://git.jotoho.de/jotoho/site-deployer/raw/branch/master/$WEBSITE_HOST/Caddyfile" >/dev/null 2>&1
FROM caddy:2
ARG WEBSITE_ARCHIVE_FOLDER
COPY --from=builder /$WEBSITE_ARCHIVE_FOLDER/public /site
COPY --from=builder /tmp/Caddyfile ./
EXPOSE 80/tcp
CMD ["caddy", "run", "--config", "./Caddyfile"]