dk: PROFILE est exporté
This commit is contained in:
parent
434a87019f
commit
a9004fa1d2
34
dk
34
dk
|
@ -57,12 +57,12 @@ function docker_parse_build_args() {
|
|||
function docker_parse_env_args() {
|
||||
[ -f .build.env ] && eval "$(docker_parse_build_args .build.env)"
|
||||
[ -f build.env ] && eval "$(docker_parse_build_args build.env)"
|
||||
[ -n "$profile" -a -f ".build.$profile.env" ] && eval "$(docker_parse_build_args ".build.$profile.env")"
|
||||
[ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && eval "$(docker_parse_build_args ".build.$PROFILE.env")"
|
||||
}
|
||||
function docker_set_env_args() {
|
||||
[ -f .build.env ] && source ./.build.env
|
||||
[ -f build.env ] && source ./build.env
|
||||
[ -n "$profile" -a -f ".build.$profile.env" ] && source "./.build.$profile.env"
|
||||
[ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && source "./.build.$PROFILE.env"
|
||||
}
|
||||
function docker_set_run_args() {
|
||||
replace_run_args+=(--env-file "$1")
|
||||
|
@ -82,14 +82,14 @@ function compose_set_env_args() {
|
|||
fi
|
||||
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")
|
||||
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}"
|
||||
COMPOSE_PROJECT_NAME="${PROJECT_NAME}_${PROFILE}"
|
||||
fi
|
||||
export COMPOSE_PROJECT_NAME
|
||||
fi
|
||||
|
@ -281,21 +281,21 @@ function auto_down() {
|
|||
DEFAULT_PROFILE=devel
|
||||
PROFILE=
|
||||
set_defaults dk
|
||||
export PROFILE
|
||||
|
||||
chdir=
|
||||
profile="$PROFILE"
|
||||
args=(
|
||||
--help '$exit_with display_help'
|
||||
-d:,--chdir: chdir=
|
||||
-p:,--profile: profile=
|
||||
-P,--prod profile=prod
|
||||
-T,--test profile=test
|
||||
-p:,--profile: PROFILE=
|
||||
-P,--prod PROFILE=prod
|
||||
-T,--test PROFILE=test
|
||||
)
|
||||
parse_args "$@"; set -- "${args[@]}"
|
||||
|
||||
# construire par défaut
|
||||
[ $# -eq 0 ] && set -- build
|
||||
[ -n "$profile" ] || profile="$DEFAULT_PROFILE"
|
||||
[ -n "$PROFILE" ] || PROFILE="$DEFAULT_PROFILE"
|
||||
|
||||
[ -n "$chdir" ] && { cd "$chdir" || die; }
|
||||
|
||||
|
@ -310,7 +310,7 @@ while [ $# -gt 0 ]; do
|
|||
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||
args+=("$1"); shift
|
||||
done
|
||||
enote "Profil $profile"
|
||||
enote "Profil $PROFILE"
|
||||
auto_build "${args[@]}" || die
|
||||
;;
|
||||
push)
|
||||
|
@ -320,7 +320,7 @@ while [ $# -gt 0 ]; do
|
|||
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||
args+=("$1"); shift
|
||||
done
|
||||
enote "Profil $profile"
|
||||
enote "Profil $PROFILE"
|
||||
auto_push "${args[@]}" || die
|
||||
;;
|
||||
s|run|start)
|
||||
|
@ -328,11 +328,11 @@ while [ $# -gt 0 ]; do
|
|||
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||
args+=("$1"); shift
|
||||
done
|
||||
enote "Profil $profile"
|
||||
enote "Profil $PROFILE"
|
||||
auto_up "${args[@]}" || die
|
||||
;;
|
||||
k|stop)
|
||||
enote "Profil $profile"
|
||||
enote "Profil $PROFILE"
|
||||
auto_stop || die
|
||||
;;
|
||||
1|up)
|
||||
|
@ -340,7 +340,7 @@ while [ $# -gt 0 ]; do
|
|||
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||
args+=("$1"); shift
|
||||
done
|
||||
enote "Profil $profile"
|
||||
enote "Profil $PROFILE"
|
||||
auto_up "${args[@]}" && auto_logs || die
|
||||
;;
|
||||
l|logs) auto_logs || die;;
|
||||
|
@ -358,7 +358,7 @@ while [ $# -gt 0 ]; do
|
|||
while [ $# -gt 0 -a "$1" != -- ]; do
|
||||
args+=("$1"); shift
|
||||
done
|
||||
enote "Profil $profile"
|
||||
enote "Profil $PROFILE"
|
||||
if auto_build; then
|
||||
auto_up "${args[@]}" && auto_logs || die
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue