dk: rendre overridable VERSION

This commit is contained in:
Jephté Clain 2018-09-27 21:46:24 +04:00
parent ed180b5bfb
commit 56b18a4eb6
1 changed files with 10 additions and 10 deletions

20
dk
View File

@ -91,6 +91,8 @@ function default_compose_build() {
"$@"
}
function default_docker_build() {
[ -n "$VERSION" ] || docker_add_build_arg VERSION "$(get_version)"
replace_build_args+=(-t "$NAME:$VERSION" -t "$NAME:latest")
docker build \
"${replace_env_args[@]}" "${env_args[@]}" \
"${replace_build_args[@]}" "${build_args[@]}" \
@ -110,9 +112,7 @@ function auto_build() {
else
docker_parse_env_args
docker_check_name
[ -n "$VERSION" ] || docker_add_build_arg VERSION "$(get_version)"
docker_add_build_arg build_date "$(date +%y%m%d)"
replace_build_args+=(-t "$NAME:$VERSION" -t "$NAME:latest")
docker_build
fi
}
@ -251,7 +251,7 @@ while [ $# -gt 0 ]; do
[ "$1" == -- ] && { shift; continue; }
cmd="$1"; shift
case "$cmd" in
build)
b|build)
[ -f .build.scripts.sh ] && source ./.build.scripts.sh
[ -f build.scripts.sh ] && source ./build.scripts.sh
args=()
@ -260,26 +260,26 @@ while [ $# -gt 0 ]; do
done
auto_build "${args[@]}" || die
;;
run|start)
s|run|start)
args=()
while [ $# -gt 0 -a "$1" != -- ]; do
args+=("$1"); shift
done
auto_up "${args[@]}" || die
;;
stop)
k|stop)
auto_stop || die
;;
up)
1|up)
args=()
while [ $# -gt 0 -a "$1" != -- ]; do
args+=("$1"); shift
done
auto_up "${args[@]}" && auto_logs || die
;;
logs) auto_logs || die;;
down) auto_down || die;;
brd)
l|logs) auto_logs || die;;
0|down) auto_down || die;;
d|brd)
do_auto_down=1
function auto_down_trap() {
[ -n "$do_auto_down" ] && auto_down
@ -305,7 +305,7 @@ while [ $# -gt 0 ]; do
done
docker image rm "${args[@]}" || die
;;
prune)
X|prune)
docker container prune -f || die
docker image prune -f || die
;;