mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
refactor to explicitly set IMAGE via get_app_image_name()
This commit is contained in:
@@ -20,8 +20,8 @@ source "$PLUGIN_PATH/common/functions"
|
||||
case "$1" in
|
||||
hello)
|
||||
[[ -z $2 ]] && echo "Please specify an app to run the command on" && exit 1
|
||||
APP="$2"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$2"; IMAGE_TAG=$(get_running_image_tag $APP); IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
echo "Hello $APP"
|
||||
;;
|
||||
@@ -80,4 +80,4 @@ A few notes:
|
||||
dokku config:set --no-restart APP KEY1=VALUE1 [KEY2=VALUE2 ...]
|
||||
dokku config:unset --no-restart APP KEY1 [KEY2 ...]
|
||||
```
|
||||
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` as sourced from common/functions.
|
||||
- As of 0.4.0, we allow image tagging and deployment of said tagged images. Therefore, hard-coding of `$IMAGE` as `dokku/$APP` is no longer sufficient. Instead, for non `pre/post-build-*` plugins, use `get_running_image_tag()` & `get_app_image_name()` as sourced from common/functions. See [pluginhooks](http://progrium.viewdocs.io/dokku/development/pluginhooks) doc for examples.
|
||||
|
||||
@@ -244,7 +244,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -253,8 +253,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1" Installing GraphicsMagick..."
|
||||
|
||||
@@ -271,7 +271,7 @@ docker commit $ID $IMAGE > /dev/null
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using buildpacks.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -280,8 +280,8 @@ docker commit $ID $IMAGE > /dev/null
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1" Installing $CONTAINER_PACKAGE..."
|
||||
|
||||
@@ -298,7 +298,7 @@ docker commit $ID $IMAGE > /dev/null
|
||||
|
||||
- Description: Allows you to run commands before environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -306,8 +306,8 @@ docker commit $ID $IMAGE > /dev/null
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
@@ -316,7 +316,7 @@ verify_app_name "$APP" "$TAG"
|
||||
|
||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to applications using a dockerfile.
|
||||
- Invoked by: `dokku release`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -324,8 +324,8 @@ verify_app_name "$APP" "$TAG"
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
@@ -360,7 +360,7 @@ fi
|
||||
|
||||
- Description: Allows the running of code before the container's process is started.
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -369,8 +369,8 @@ fi
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
dokku_log_info1 "Running gulp"
|
||||
id=$(docker run -d $IMAGE /bin/bash -c "cd /app && gulp default")
|
||||
@@ -399,7 +399,7 @@ curl "http://httpstat.us/200"
|
||||
|
||||
- Description: Can be used to run commands before an app is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -409,9 +409,8 @@ curl "http://httpstat.us/200"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
|
||||
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"
|
||||
TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; GULP_CACHE_DIR="$DOKKU_ROOT/$APP/gulp"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
if [[ -d $GULP_CACHE_DIR ]]; then
|
||||
docker run --rm -v "$GULP_CACHE_DIR:/gulp" "$IMAGE" find /gulp -depth -mindepth 1 -maxdepth 1 -exec rm -Rf {} \; || true
|
||||
@@ -422,7 +421,7 @@ fi
|
||||
|
||||
- Description: Can be used to run commands after an application is deleted.
|
||||
- Invoked by: `dokku apps:destroy`
|
||||
- Arguments: `$APP`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -456,7 +455,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku deploy`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -464,8 +463,8 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
@@ -474,7 +473,7 @@ verify_app_name "$APP" "$TAG"
|
||||
|
||||
- Description:
|
||||
- Invoked by: `dokku run`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -482,8 +481,8 @@ verify_app_name "$APP" "$TAG"
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_PATH/common/functions"
|
||||
APP="$1"; TAG=$(get_running_image_tag $APP)
|
||||
verify_app_name "$APP" "$TAG"
|
||||
APP="$1"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
verify_app_name "$APP"
|
||||
|
||||
# TODO
|
||||
```
|
||||
@@ -634,7 +633,7 @@ pluginhook receive-app $APP $newrev
|
||||
|
||||
- Description: Allows you to run commands once a tag for an application image has been added
|
||||
- Invoked by: `dokku tag:add`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -642,18 +641,18 @@ pluginhook receive-app $APP $newrev
|
||||
# Upload an application image to docker hub
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; TAG="$2"; IMAGE="dokku/${APP}:${TAG}"
|
||||
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||
|
||||
IMAGE_ID=$(docker inspect --format '{{ .Id }}' $IMAGE)
|
||||
docker tag -f $IMAGE_ID $DOCKER_HUB_USER/$APP:$TAG
|
||||
docker push $DOCKER_HUB_USER/$APP:$TAG
|
||||
docker tag -f $IMAGE_ID $DOCKER_HUB_USER/$APP:$IMAGE_TAG
|
||||
docker push $DOCKER_HUB_USER/$APP:$IMAGE_TAG
|
||||
```
|
||||
|
||||
### `tag-remove`
|
||||
|
||||
- Description: Allows you to run commands once a tag for an application image has been removed
|
||||
- Invoked by: `dokku tag:remove`
|
||||
- Arguments: `$APP $TAG`
|
||||
- Arguments: `$APP $IMAGE_TAG`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -661,7 +660,7 @@ docker push $DOCKER_HUB_USER/$APP:$TAG
|
||||
# Remove an image tag from docker hub
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
APP="$1"; TAG="$2"
|
||||
APP="$1"; IMAGE_TAG="$2"
|
||||
|
||||
some code to remove a docker hub tag because it's not implemented in the CLI....
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user