diff options
Diffstat (limited to 'caddy')
-rw-r--r-- | caddy/Dockerfile | 13 | ||||
-rw-r--r-- | caddy/README.md | 19 | ||||
-rw-r--r-- | caddy/entrypoint.sh | 23 |
3 files changed, 55 insertions, 0 deletions
diff --git a/caddy/Dockerfile b/caddy/Dockerfile new file mode 100644 index 0000000..0260dda --- /dev/null +++ b/caddy/Dockerfile @@ -0,0 +1,13 @@ +FROM alpine:3.19 + +# install packages +RUN apk add --no-cache tini wget +RUN rm -fr /var/cache/apk/* + +# copy entrypoint +COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + +# execute +ENTRYPOINT ["/sbin/tini", "--" ] +CMD ["/usr/local/bin/entrypoint.sh"] diff --git a/caddy/README.md b/caddy/README.md new file mode 100644 index 0000000..c0b5d62 --- /dev/null +++ b/caddy/README.md @@ -0,0 +1,19 @@ +### images/caddy + +runs a caddy server! + +#### volumes + +- /data - stores certificates, ocsp, and most of caddys state +- /config - stores autosave.json + +#### environment + +using the MODULES environment variables you can configure +extra modules to add to caddy. view the modules [here](https://caddyserver.com/download). + +MODULES should be seperated by a space and not include the github.com/ part. (e.g. "caddy-dns/cloudflare aksdb/caddy-cgi/v2") + +#### config + +the caddy file is run at /etc/caddy/Caddyfile, put a volume at /etc/caddy to modify it. diff --git a/caddy/entrypoint.sh b/caddy/entrypoint.sh new file mode 100644 index 0000000..d8c4fc4 --- /dev/null +++ b/caddy/entrypoint.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +URL="https://caddyserver.com/api/download?os=linux&arch=amd64" +IFS=" " +for module in $MODULES +do + module=$(echo "$module" | sed 's/\//%2F/g') + URL="$URL&p=github.com/$module" +done + +wget "$URL" -O /usr/sbin/caddy +chmod +x /usr/sbin/caddy + +if [ ! -f "/etc/caddy/Caddyfile" ]; then + cp /etc/default/Caddyfile /etc/caddy/Caddyfile +fi + +export XDG_CONFIG_HOME=/config +export XDG_DATA_HOME=/data + +exec /usr/sbin/caddy run \ + --config /etc/caddy/Caddyfile \ + --adapter caddyfile |