pass COMPOSE_PROJECT_NAME env var in container mode

Avoids the surprise of finding the project name set to the directory
name when COMPOSE_PROJECT_NAME is being used.

Signed-off-by: Santiago M. Mola <santi@mola.io>
This commit is contained in:
Santiago M. Mola 2020-07-03 12:04:47 +02:00 committed by Ulysses Souza
parent c17ef995b4
commit 0ea51906cd
1 changed files with 3 additions and 0 deletions

View File

@ -38,6 +38,9 @@ if [ -n "$COMPOSE_FILE" ]; then
COMPOSE_OPTIONS="$COMPOSE_OPTIONS -e COMPOSE_FILE=$COMPOSE_FILE" COMPOSE_OPTIONS="$COMPOSE_OPTIONS -e COMPOSE_FILE=$COMPOSE_FILE"
compose_dir=$(realpath "$(dirname "$COMPOSE_FILE")") compose_dir=$(realpath "$(dirname "$COMPOSE_FILE")")
fi fi
if [ -n "$COMPOSE_PROJECT_NAME" ]; then
COMPOSE_OPTIONS="-e COMPOSE_PROJECT_NAME $COMPOSE_OPTIONS"
fi
# TODO: also check --file argument # TODO: also check --file argument
if [ -n "$compose_dir" ]; then if [ -n "$compose_dir" ]; then
VOLUMES="$VOLUMES -v $compose_dir:$compose_dir" VOLUMES="$VOLUMES -v $compose_dir:$compose_dir"