feat: add labels to all build, commit, create, and run docker calls

This will allow us to further filter containers and images by application when cleaning up containers.

Refs #3515
This commit is contained in:
Jose Diaz-Gonzalez
2019-06-29 15:33:24 -04:00
parent 968543c66c
commit d1af10fc51
9 changed files with 59 additions and 37 deletions

View File

@@ -17,6 +17,8 @@ scheduler-docker-local-pre-deploy() {
return
fi
local DOCKER_RUN_LABEL_ARGS="--label=org.label-schema.schema-version=1.0 --label=org.label-schema.vendor=dokku --label=com.dokku.app-name=$APP"
IMAGE=$(get_app_image_name "$APP" "$IMAGE_TAG")
DOKKU_APP_TYPE=$(config_get "$APP" DOKKU_APP_TYPE || true)
@@ -42,7 +44,7 @@ scheduler-docker-local-pre-deploy() {
fi
# shellcheck disable=SC2086
"$DOCKER_BIN" run $DOKKU_GLOBAL_RUN_ARGS "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
"$DOCKER_BIN" run "${DOCKER_RUN_LABEL_ARGS[@]}" "${DOKKU_GLOBAL_RUN_ARGS[@]}" "${ARG_ARRAY[@]}" $IMAGE /bin/bash -c "find $CONTAINER_PATHS -not -user $DOKKU_APP_USER -print0 | xargs -0 -r chown -R $DOKKU_APP_USER" || true
}
scheduler-docker-local-pre-deploy "$@"