more docker updates

This commit is contained in:
Ross
2025-12-01 13:31:08 +00:00
parent fd6e25d55e
commit 9ed789ba90
11 changed files with 206 additions and 20 deletions
+23 -1
View File
@@ -19,4 +19,26 @@ fi
COMPOSE_ENV=${COMPOSE_ENV:-dev}
echo "Starting compose with COMPOSE_ENV=$COMPOSE_ENV (using .env.$COMPOSE_ENV)"
COMPOSE_ENV=$COMPOSE_ENV docker compose -f docker/docker-compose.prod.yml -f docker/docker-compose.dev.yml up -d --build
# Load variables from .env.<env> into the environment so Compose variable
# substitution (e.g. ${NGINX_HTTP_PORT}) works. We export all variables from
# the file for the duration of the command.
ENV_FILE="$REPO_ROOT/.env.$COMPOSE_ENV"
if [ -f "$ENV_FILE" ]; then
# Export variables from the .env file safely without sourcing it. Some
# values include characters (parentheses, ampersands) that break POSIX
# shell parsing if the file is sourced directly. Read line-by-line,
# ignore comments/empty lines and export KEY=VALUE pairs.
while IFS= read -r _line || [ -n "$_line" ]; do
line="$_line"
case "$line" in
''|\#*) continue ;;
esac
# Split on first '=' into key and value
key=${line%%=*}
val=${line#*=}
# Export directly (preserves special characters in the value)
export "$key=$val"
done < "$ENV_FILE"
fi
COMPOSE_ENV=$COMPOSE_ENV docker compose -f docker/docker-compose.prod.yml -f docker/docker-compose.dev.yml up --build