caddy container now uses environment variables

This commit is contained in:
Christopher Bisset 2022-08-11 11:00:04 +10:00
parent 1f3814597e
commit e1f116bf06
3 changed files with 15 additions and 11 deletions

View file

@ -1,9 +1,18 @@
{
skip_install_trust
http_port 8080
https_port 443
http_port {$HTTP_PORT}
https_port {$HTTPS_PORT}
}
:443 {
:{$HTTP_PORT} {
redir / /web
uri strip_prefix /web
file_server {
root /web
}
}
:{$HTTPS_PORT} {
redir / /web
uri strip_prefix /web
tls internal {

View file

@ -34,8 +34,9 @@ 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"
# Ports that caddy will run on
ENV HTTPS_PORT="443"
ENV HTTP_PORT="80"
# Production Web Server port. Runs a self signed SSL certificate
EXPOSE 443

View file

@ -12,11 +12,5 @@ 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