mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-03-15 13:36:18 +00:00
add Caddy and Authelia support with configuration scripts and Docker setup
This commit is contained in:
13
containers/authelia/Dockerfile-authelia
Normal file
13
containers/authelia/Dockerfile-authelia
Normal file
@@ -0,0 +1,13 @@
|
||||
FROM alpine:latest AS tools
|
||||
RUN apk add --no-cache inotify-tools
|
||||
|
||||
FROM authelia/authelia:latest
|
||||
|
||||
COPY --from=tools /usr/bin/inotifywait /usr/bin/inotifywait
|
||||
COPY --from=tools /usr/lib/libinotifytools* /usr/lib/
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/authelia-entrypoint.sh
|
||||
|
||||
RUN chmod +x /usr/local/bin/authelia-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/authelia-entrypoint.sh"]
|
||||
39
containers/authelia/entrypoint.sh
Normal file
39
containers/authelia/entrypoint.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
CONFIG_PATH="/config/configuration.yml"
|
||||
MAX_WAIT=120
|
||||
WAIT_INTERVAL=2
|
||||
|
||||
echo "==> Waiting for Authelia configuration file..."
|
||||
elapsed=0
|
||||
while [ ! -f "$CONFIG_PATH" ]; do
|
||||
if [ "$elapsed" -ge "$MAX_WAIT" ]; then
|
||||
echo "Error: Timed out waiting for ${CONFIG_PATH} after ${MAX_WAIT}s"
|
||||
exit 1
|
||||
fi
|
||||
sleep "$WAIT_INTERVAL"
|
||||
elapsed=$((elapsed + WAIT_INTERVAL))
|
||||
done
|
||||
echo "==> Configuration file found: ${CONFIG_PATH}"
|
||||
|
||||
echo "==> Starting Authelia..."
|
||||
authelia --config "$CONFIG_PATH" &
|
||||
AUTHELIA_PID=$!
|
||||
|
||||
sleep 3
|
||||
|
||||
echo "==> Watching ${CONFIG_PATH} for changes..."
|
||||
while true; do
|
||||
inotifywait -qq -e close_write,moved_to "${CONFIG_PATH}" 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
echo "==> Configuration change detected, restarting Authelia..."
|
||||
kill "$AUTHELIA_PID" 2>/dev/null || true
|
||||
wait "$AUTHELIA_PID" 2>/dev/null || true
|
||||
|
||||
authelia --config "$CONFIG_PATH" &
|
||||
AUTHELIA_PID=$!
|
||||
echo "==> Authelia restarted with PID ${AUTHELIA_PID}"
|
||||
done
|
||||
Reference in New Issue
Block a user