allow tagging and deployment of tagged app images

This commit is contained in:
Michael Hobbs
2015-06-10 14:21:47 -07:00
parent 03165ee3f8
commit 04a4da7fc5
16 changed files with 300 additions and 102 deletions

View File

@@ -5,7 +5,9 @@ source "$PLUGIN_PATH/config/functions"
case "$1" in
build)
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TMP_WORK_DIR="$4"
verify_app_name "$APP"
CACHE_DIR="$DOKKU_ROOT/$APP/cache"
eval "$(config_export app $APP)"
@@ -58,14 +60,16 @@ case "$1" in
;;
release)
APP="$2"; IMAGE="dokku/$APP"; IMAGE_SOURCE_TYPE="$3"
APP="$2"; IMAGE_SOURCE_TYPE="$3"; TAG="$4"
verify_app_name "$APP" "$TAG"
case "$IMAGE_SOURCE_TYPE" in
herokuish)
# *DEPRECATED* in v0.3.15: `pluginhook pre-release` will be removed in future releases
pluginhook pre-release "$APP"
pluginhook pre-release "$APP" "$TAG"
# *DEPRECATED* in v0.3.22: `pluginhook pre-release-buildstep` will be removed in future releases
pluginhook pre-release-buildstep "$APP"
pluginhook pre-release-buildpack "$APP"
pluginhook pre-release-buildstep "$APP" "$TAG"
pluginhook pre-release-buildpack "$APP" "$TAG"
if [[ -n $(config_export global) ]]; then
id=$(config_export global | docker run -i -a stdin $IMAGE /bin/bash -c "mkdir -p /app/.profile.d && cat > /app/.profile.d/00-global-env.sh")
test "$(docker wait $id)" -eq 0
@@ -77,15 +81,15 @@ case "$1" in
docker commit $id $IMAGE > /dev/null
fi
# *DEPRECATED* in v0.3.15: `pluginhook post-release` will be removed in future releases
pluginhook post-release "$APP"
pluginhook post-release "$APP" "$TAG"
# *DEPRECATED* in v0.3.22: `pluginhook post-release-buildstep` will be removed in future releases
pluginhook post-release-buildstep "$APP"
pluginhook post-release-buildpack "$APP"
pluginhook post-release-buildstep "$APP" "$TAG"
pluginhook post-release-buildpack "$APP" "$TAG"
;;
dockerfile)
pluginhook pre-release-dockerfile "$APP"
pluginhook post-release-dockerfile "$APP"
pluginhook pre-release-dockerfile "$APP" "$TAG"
pluginhook post-release-dockerfile "$APP" "$TAG"
;;
*)
@@ -140,8 +144,7 @@ case "$1" in
logs)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2";
APP="$2"; verify_app_name "$2"
if (is_deployed $APP); then
CONTAINER_IDS=( $(get_app_container_ids $APP) )
@@ -167,13 +170,13 @@ case "$1" in
run)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2"; IMAGE="dokku/$APP"
APP="$2"; TAG=$(get_running_image_tag $APP)
verify_app_name "$APP" "$TAG"
shift 2
DOCKER_ARGS=$(: | pluginhook docker-args $APP run)
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP)
DOCKER_ARGS=$(: | pluginhook docker-args $APP run $TAG)
DOCKER_ARGS+=$(: | pluginhook docker-args-run $APP $TAG)
[[ $DOKKU_RM_CONTAINER ]] && DOKKU_RUN_OPTS="--rm"
has_tty && DOKKU_RUN_OPTS+=" -i -t"
is_image_herokuish_based "$IMAGE" && EXEC_CMD="/exec"
@@ -183,9 +186,7 @@ case "$1" in
url | urls)
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
verify_app_name "$2"
APP="$2";
APP="$2"; verify_app_name "$2"
eval "$(config_export app $APP)"
if [[ -s "$DOKKU_ROOT/$APP/URLS" ]]; then