diff --git a/dk b/dk index 37f789d..5a53109 100755 --- a/dk +++ b/dk @@ -80,8 +80,19 @@ function compose_set_env_args() { if [ -f docker-compose.override.yml ]; then replace_env_args+=(-f docker-compose.override.yml) fi - if [ -n "$profile" -a -f "docker-compose.$profile.yml" ]; then - replace_env_args+=(-f "docker-compose.$profile.yml") + local PROJECT_NAME=--none-- + [ -f .compose.env ] && source ./.compose.env + if [ -n "$profile" ]; then + if [ -f "docker-compose.$profile.yml" ]; then + replace_env_args+=(-f "docker-compose.$profile.yml") + fi + if [ "$PROJECT_NAME" != --none-- ]; then + if [ -z "$COMPOSE_PROJECT_NAME" ]; then + [ -n "$PROJECT_NAME" ] || PROJECT_NAME="$(basename -- "$(pwd)")" + COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${profile}" + fi + export COMPOSE_PROJECT_NAME + fi fi }