feat: allow passing labels to one-off dokku containers

This feature is allows users to add extra label metadata to one-off containers. As this can interfere with Dokku internals if they shadow labels used by plugins, care should be taken to avoid the `com.dokku` or `org.label-schema` namespace.

Also proper name run containers so they don't get random names from docker...
This commit is contained in:
Jose Diaz-Gonzalez
2019-09-16 23:07:01 -04:00
parent a3ef91f2ae
commit 798725bb54
4 changed files with 39 additions and 3 deletions

View File

@@ -336,6 +336,8 @@ parse_args() {
local next_index=1
local skip=false
local args=("$@")
local flags
for arg in "$@"; do
if [[ "$skip" == "true" ]]; then
next_index=$((next_index + 1))
@@ -364,8 +366,22 @@ parse_args() {
skip=true
;;
esac
if [[ "$skip" == "true" ]]; then
flags="${flags} ${arg}"
elif [[ "$arg" == "--app" ]]; then
flags="${flags} ${arg}=${args[$next_index]}"
elif [[ "$arg" =~ ^--.* ]]; then
flags="${flags} ${arg}"
fi
next_index=$((next_index + 1))
done
if [[ -z "$DOKKU_GLOBAL_FLAGS" ]]; then
export DOKKU_GLOBAL_FLAGS="$(echo -e "${flags}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
fi
return 0
}