chore: move Caddyfile from /etc to /etc/caddy

move Caddyfile, so that it can be in a volume.
when using volumes and not bind mounts one can not simply mount a whole directory,
after this change mounting /etc/caddy works as intended
This commit is contained in:
Jan Christian Grünhage 2018-02-19 16:44:07 +01:00
parent 36fcd5172d
commit 7431af5d95
2 changed files with 7 additions and 7 deletions

View File

@ -2,4 +2,4 @@ FROM docker.jcg.re/base-caddy
RUN apk add --no-cache bash
ADD root /
EXPOSE 2015 80 443
VOLUME ["/caddy", "/var/www"]
VOLUME ["/etc/caddy", "/var/www"]

View File

@ -1,8 +1,8 @@
#!/bin/bash
if [[ -z ${CADDYPATH} ]]; then
export CADDYPATH=/caddy
export CADDYPATH=/etc/caddy
fi
P="--conf /etc/Caddyfile"
P="--conf ${CADDYPATH}/Caddyfile"
if [[ -n ${USE_QUIC} ]]; then
P="-quic $P"
fi
@ -11,12 +11,12 @@ if [[ -n ${LE_STAGING} ]]; then
fi
chown -R ${UID}:${GID} /var/www
chown -R ${UID}:${GID} ${CADDYPATH}
if [[ ! -f /etc/Caddyfile ]]; then
if [[ ! -f ${CADDYPATH}/Caddyfile ]]; then
if [[ -z "$DOMAIN" || -z "$EMAIL" ]]; then
cp /etc/Caddyfile.insecure.template /etc/Caddyfile
cp /etc/Caddyfile.insecure.template ${CADDYPATH}/Caddyfile
else
cp /etc/Caddyfile.secure.template /etc/Caddyfile
sed -i -e "s/DOMAIN/${DOMAIN}/" -e "s/EMAIL/${EMAIL}/" /etc/Caddyfile
cp /etc/Caddyfile.secure.template ${CADDYPATH}/Caddyfile
sed -i -e "s/DOMAIN/${DOMAIN}/" -e "s/EMAIL/${EMAIL}/" ${CADDYPATH}/Caddyfile
fi
fi
cd ${CADDYPATH}