From 30f5b8c21eccdc62d1bc411ae2803ddcee0459b0 Mon Sep 17 00:00:00 2001 From: Dominik George <dominik.george@teckids.org> Date: Mon, 8 Apr 2024 23:42:29 +0200 Subject: [PATCH] Add Docker and Caddy for hosting outside GitLab pages --- Caddyfile | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 17 +++++++++++++++++ config.toml | 4 ++-- 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 Caddyfile create mode 100644 Dockerfile diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 00000000..7416457a --- /dev/null +++ b/Caddyfile @@ -0,0 +1,35 @@ +http://teckids.org { + root * /srv + encode zstd gzip + file_server + + header { + Content-Security-Policy "default-src 'self'; img-src 'self' data:; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content; base-uri 'self'" + X-Content-Type-Options nosniff + Referrer-Policy strict-origin-when-cross-origin + } + + route { + header Cache-Control "public, max-age=3600" + header /processed_images/* Cache-Control "public, max-age=604800, immutable" + } +} + +http://www.teckids.org { + redir http://teckids.org{uri} permanent +} + +http://hacknsun.camp, http://www.hacknsun.camp { + redir / http://teckids.org/projekte/hack-n-fun/freizeiten/hacknsun/ permanent + error 404 +} + +http://hacknfun.camp, http://www.hacknfun.camp { + redir / http://teckids.org/projekte/hack-n-fun/ permanent + error 404 +} + +http://schul-frei.dev, http://www.schul-frei.dev { + redir / http://teckids.org/projekte/schul-frei/ permanent + error 404 +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..54609ce1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM alpine:latest AS build + +RUN apk add --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ zola yarn + +COPY . /src +WORKDIR /src + +RUN yarn install +RUN zola build + + +FROM caddy:alpine AS serve + +COPY --from=build /src/public/ /srv/ +COPY Caddyfile /etc/caddy/Caddyfile + +RUN caddy fmt --overwrite /etc/caddy/Caddyfile diff --git a/config.toml b/config.toml index 1b429590..d01ae5d2 100644 --- a/config.toml +++ b/config.toml @@ -9,8 +9,8 @@ output_dir = "public" compile_sass = true build_search_index = false generate_feed = true -hard_link_static = true -#minify_html = true +hard_link_static = false +minify_html = false taxonomies = [ # Static content groups -- GitLab