Refactor docker-compose setup and update Authentik version to 2025.4.2
This commit is contained in:
parent
81b2fbc91c
commit
321acaf85d
8 changed files with 285 additions and 392 deletions
41
scripts/compose.sh
Executable file
41
scripts/compose.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euf -o pipefail
|
||||
|
||||
# Check if yq is installed
|
||||
if ! command -v yq &>/dev/null; then
|
||||
echo "yq is required but not installed. Please install it manually."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STAGE="${1:-}"
|
||||
shift || true
|
||||
|
||||
if [[ -z "${STAGE,,}" ]]; then
|
||||
echo "Usage: $0 <prod|test>"
|
||||
echo "Example: $0 test"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${STAGE,,}" == "prod" ]]; then
|
||||
DOCKER_COMPOSE_CLI="docker compose"
|
||||
elif [[ "${STAGE,,}" == "test" ]]; then
|
||||
DOCKER_COMPOSE_CLI="docker-compose-2.32.4"
|
||||
else
|
||||
echo "Invalid stage: ${STAGE,,}. Use 'prod' or 'test'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$(dirname "$(realpath "$0")")/../"
|
||||
AUTHENTIK_DOCKER_COMPOSE_PATH="$(realpath "$(pwd)")"
|
||||
|
||||
# Merge docker-compose files using yq
|
||||
# 1st merger is docker-compose.override.yml on top of the base docker-compose.yml
|
||||
# 2nd merger is the stage-specific docker-compose file on top of the result of the first merger
|
||||
# The final result is piped to docker compose command
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' \
|
||||
docker-compose.yml \
|
||||
docker-compose.override.yml \
|
||||
| yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' \
|
||||
- \
|
||||
docker-compose.${STAGE,,}.yml \
|
||||
| ${DOCKER_COMPOSE_CLI} -f- ${@:-}
|
Loading…
Add table
Add a link
Reference in a new issue