From 09da09bea63f166490c35b3d7fff523bdf255300 Mon Sep 17 00:00:00 2001 From: Christopher Bisset Date: Tue, 2 Aug 2022 17:16:06 +1000 Subject: [PATCH] added custom port option --- docker/production/dockerfile | 2 ++ docker/production/scripts/2-initialise.sh | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/docker/production/dockerfile b/docker/production/dockerfile index e52f8d4..55597e7 100644 --- a/docker/production/dockerfile +++ b/docker/production/dockerfile @@ -30,6 +30,8 @@ FROM alpine:latest ENV PROJECT_NAME="headscale-ui" # URL for the github/git location ENV PROJECT_URL="https://github.com/gurucomputing/headscale-ui" +# Port that caddy will run on +ENV PORT="443" # Production Web Server port. Runs a self signed SSL certificate EXPOSE 443 diff --git a/docker/production/scripts/2-initialise.sh b/docker/production/scripts/2-initialise.sh index 710e110..c01277e 100644 --- a/docker/production/scripts/2-initialise.sh +++ b/docker/production/scripts/2-initialise.sh @@ -12,5 +12,11 @@ then cp /staging/Caddyfile /data/Caddyfile fi +# replace port in Caddyfile if set +if [ "$PORT" != "443" ] +then + sed -i "s/:443/$PORT/g" /data/Caddyfile +fi + echo "Starting Caddy" /usr/sbin/caddy run --adapter caddyfile --config /data/Caddyfile \ No newline at end of file