Merge pull request #3865 from dokku/label-cleanup
Cleanup injected docker labels
This commit is contained in:
@@ -971,6 +971,8 @@ haproxy-build-config "$APP"
|
|||||||
|
|
||||||
### `post-release-buildpack`
|
### `post-release-buildpack`
|
||||||
|
|
||||||
|
> Warning: Image mutation in this trigger may result in an invalid run state, and is heavily discouraged.
|
||||||
|
|
||||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to apps using buildpacks.
|
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to apps using buildpacks.
|
||||||
- Invoked by: `internal function dokku_release() (release phase)`
|
- Invoked by: `internal function dokku_release() (release phase)`
|
||||||
- Arguments: `$APP $IMAGE_TAG`
|
- Arguments: `$APP $IMAGE_TAG`
|
||||||
@@ -978,27 +980,19 @@ haproxy-build-config "$APP"
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Installs a package specified by the `CONTAINER_PACKAGE` env var
|
|
||||||
|
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
APP="$1"; IMAGE_TAG="$2"; IMAGE=$(get_app_image_name $APP $IMAGE_TAG)
|
||||||
verify_app_name "$APP"
|
verify_app_name "$APP"
|
||||||
|
|
||||||
dokku_log_info1 "Installing $CONTAINER_PACKAGE..."
|
# TODO
|
||||||
|
|
||||||
CMD="cat > gm && \
|
|
||||||
dpkg -s CONTAINER_PACKAGE >/dev/null 2>&1 || \
|
|
||||||
(apt-get update && apt-get install -y CONTAINER_PACKAGE && apt-get clean)"
|
|
||||||
|
|
||||||
CID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
|
||||||
test $(docker wait $CID) -eq 0
|
|
||||||
DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP")
|
|
||||||
docker commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" $CID $IMAGE >/dev/null
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### `post-release-dockerfile`
|
### `post-release-dockerfile`
|
||||||
|
|
||||||
|
> Warning: Image mutation in this trigger may result in an invalid run state, and is heavily discouraged.
|
||||||
|
|
||||||
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to apps using a dockerfile.
|
- Description: Allows you to run commands after environment variables are set for the release step of the deploy. Only applies to apps using a dockerfile.
|
||||||
- Invoked by: `internal function dokku_release() (release phase)`
|
- Invoked by: `internal function dokku_release() (release phase)`
|
||||||
- Arguments: `$APP $IMAGE_TAG`
|
- Arguments: `$APP $IMAGE_TAG`
|
||||||
@@ -1183,9 +1177,9 @@ CMD="cat > gm && \
|
|||||||
dpkg -s graphicsmagick >/dev/null 2>&1 || \
|
dpkg -s graphicsmagick >/dev/null 2>&1 || \
|
||||||
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
|
(apt-get update && apt-get install -y graphicsmagick && apt-get clean)"
|
||||||
|
|
||||||
CID=$(docker run "${DOCKER_COMMIT_LABEL_ARGS[@]}" -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
CID=$(docker run $DOKKU_GLOBAL_RUN_ARGS -i -a stdin $IMAGE /bin/bash -c "$CMD")
|
||||||
DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP")
|
|
||||||
test $(docker wait $CID) -eq 0
|
test $(docker wait $CID) -eq 0
|
||||||
|
DOCKER_COMMIT_LABEL_ARGS=("--change" "LABEL org.label-schema.schema-version=1.0" "--change" "LABEL org.label-schema.vendor=dokku" "--change" "LABEL com.dokku.app-name=$APP")
|
||||||
docker commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" $CID $IMAGE >/dev/null
|
docker commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" $CID $IMAGE >/dev/null
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
|
|
||||||
trigger-builder-dockerfile-builder-release() {
|
trigger-builder-dockerfile-builder-release() {
|
||||||
declare desc="builder-dockerfile builder-release plugin trigger"
|
declare desc="builder-dockerfile builder-release plugin trigger"
|
||||||
@@ -13,6 +14,9 @@ trigger-builder-dockerfile-builder-release() {
|
|||||||
|
|
||||||
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
|
# buildstep plugins don't necessarily make sense for dockerfiles. call the new breed!!!
|
||||||
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
|
plugn trigger pre-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||||
|
|
||||||
|
local IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
|
||||||
|
echo "FROM $IMAGE" | "$DOCKER_BIN" image build --label=com.dokku.image-stage=release -t "$IMAGE" -
|
||||||
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
|
plugn trigger post-release-dockerfile "$APP" "$IMAGE_TAG"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $DOKKU_TRACE ]] && set -x
|
[[ $DOKKU_TRACE ]] && set -x
|
||||||
|
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||||
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
source "$PLUGIN_AVAILABLE_PATH/config/functions"
|
||||||
|
|
||||||
trigger-builder-herokuish-builder-release() {
|
trigger-builder-herokuish-builder-release() {
|
||||||
@@ -36,6 +37,8 @@ trigger-builder-herokuish-builder-release() {
|
|||||||
|
|
||||||
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
"$DOCKER_BIN" container commit "${DOCKER_COMMIT_LABEL_ARGS[@]}" "$CID" "$IMAGE" >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "FROM $IMAGE" | "$DOCKER_BIN" image build --label=com.dokku.image-stage=release -t "$IMAGE" -
|
||||||
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
plugn trigger post-release-buildpack "$APP" "$IMAGE_TAG"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ func CommandCreate(networkName string) error {
|
|||||||
"create",
|
"create",
|
||||||
"--attachable",
|
"--attachable",
|
||||||
"--label",
|
"--label",
|
||||||
"com.dokku.network=true",
|
|
||||||
"--label",
|
|
||||||
fmt.Sprintf("com.dokku.network-name=%v", networkName),
|
fmt.Sprintf("com.dokku.network-name=%v", networkName),
|
||||||
networkName,
|
networkName,
|
||||||
}, " "))
|
}, " "))
|
||||||
|
|||||||
@@ -69,11 +69,12 @@ trigger-scheduler-docker-local-scheduler-deploy() {
|
|||||||
local port=""
|
local port=""
|
||||||
local ipaddr=""
|
local ipaddr=""
|
||||||
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
|
local DOKKU_CONTAINER_ID_FILE="$DOKKU_ROOT/$APP/CONTAINER.$PROC_TYPE.$CONTAINER_INDEX"
|
||||||
|
local DYNO="$PROC_TYPE.$CONTAINER_INDEX"
|
||||||
|
|
||||||
# start the app
|
# start the app
|
||||||
local DOCKER_ARGS
|
local DOCKER_ARGS
|
||||||
DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
|
DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
|
||||||
DOCKER_ARGS+=" -e DYNO=$PROC_TYPE.$CONTAINER_INDEX "
|
DOCKER_ARGS+=" -e DYNO=$DYNO "
|
||||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
|
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-deploy "$APP" "$IMAGE_SOURCE_TYPE" "$IMAGE_TAG" "$PROC_TYPE" "$CONTAINER_INDEX")
|
||||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" -e TRACE=true "
|
||||||
|
|
||||||
@@ -98,16 +99,16 @@ trigger-scheduler-docker-local-scheduler-deploy() {
|
|||||||
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH" "$DOKKU_PORT")
|
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH" "$DOKKU_PORT")
|
||||||
if [[ "$DOKKU_NETWORK_BIND_ALL" == "false" ]]; then
|
if [[ "$DOKKU_NETWORK_BIND_ALL" == "false" ]]; then
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cid=$("$DOCKER_BIN" container create --label=com.dokku.container-type=deploy --label=com.dokku.process-type=$PROC_TYPE "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --init --env PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
|
cid=$("$DOCKER_BIN" container create --label=com.dokku.container-type=deploy --label=com.dokku.process-type=$PROC_TYPE --label=com.dokku.dyno=$DYNO "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --init --env PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
|
||||||
else
|
else
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cid=$("$DOCKER_BIN" container create --label=com.dokku.container-type=deploy --label=com.dokku.process-type=$PROC_TYPE "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --init $DOKKU_DOCKER_PORT_ARGS --env PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
|
cid=$("$DOCKER_BIN" container create --label=com.dokku.container-type=deploy --label=com.dokku.process-type=$PROC_TYPE --label=com.dokku.dyno=$DYNO "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --init $DOKKU_DOCKER_PORT_ARGS --env PORT=$DOKKU_PORT "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH")
|
START_CMD=$(fn-scheduler-docker-local-extract-start-cmd "$APP" "$PROC_TYPE" "$START_CMD" "$DOKKU_HEROKUISH")
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
cid=$("$DOCKER_BIN" container create --label=com.dokku.container-type=deploy --label=com.dokku.process-type=$PROC_TYPE "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --init "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
|
cid=$("$DOCKER_BIN" container create --label=com.dokku.container-type=deploy --label=com.dokku.process-type=$PROC_TYPE --label=com.dokku.dyno=$DYNO "${DOCKER_RUN_LABEL_ARGS[@]}" $DOKKU_GLOBAL_RUN_ARGS --init "${ARG_ARRAY[@]}" $IMAGE $START_CMD)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
plugn trigger post-container-create "app" "$cid" "$APP" "deploy" "$PROC_TYPE"
|
plugn trigger post-container-create "app" "$cid" "$APP" "deploy" "$PROC_TYPE"
|
||||||
|
|||||||
Reference in New Issue
Block a user