mirror of
https://github.com/dokku/dokku.git
synced 2025-12-16 12:07:45 +01:00
87 lines
1.7 KiB
Bash
Executable File
87 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eo pipefail
|
|
[[ $DOKKU_TRACE ]] && set -x
|
|
|
|
trigger-docker-options-docker-args() {
|
|
declare desc="docker args plugin trigger"
|
|
declare trigger="$0"
|
|
declare APP="$1" IMAGE_SOURCE_TYPE="$2"
|
|
local STDIN=$(cat)
|
|
|
|
case "$0" in
|
|
*docker-args-build)
|
|
local PHASE=BUILD
|
|
;;
|
|
*docker-args-deploy)
|
|
local PHASE=DEPLOY
|
|
;;
|
|
*docker-args-run)
|
|
local PHASE=RUN
|
|
;;
|
|
esac
|
|
|
|
local FILE_PREFIX="DOCKER_OPTIONS_"
|
|
local PHASE_FILE_PATH="${DOKKU_ROOT}/${APP}/${FILE_PREFIX}${PHASE}"
|
|
|
|
local output=""
|
|
|
|
if [[ -f "$PHASE_FILE_PATH" ]]; then
|
|
local DONE=false
|
|
until $DONE; do
|
|
local line
|
|
read -r line || local DONE=true
|
|
|
|
[[ -z "$line" ]] && continue
|
|
|
|
case "$line" in
|
|
\#*)
|
|
continue
|
|
;;
|
|
|
|
--restart*)
|
|
if [[ "$PHASE" == "DEPLOY" ]]; then
|
|
local output="$output $line"
|
|
fi
|
|
continue
|
|
;;
|
|
|
|
*)
|
|
case "$IMAGE_SOURCE_TYPE" in
|
|
dockerfile | nixpacks | railpack)
|
|
case "$line" in
|
|
--link* | -v* | --volume*)
|
|
continue
|
|
;;
|
|
|
|
*)
|
|
local output="$output $line"
|
|
;;
|
|
esac
|
|
;;
|
|
|
|
herokuish)
|
|
case "$line" in
|
|
--file* | --build-args*)
|
|
continue
|
|
;;
|
|
|
|
*)
|
|
local output="$output $line"
|
|
;;
|
|
esac
|
|
;;
|
|
|
|
*)
|
|
local output="$output $line"
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
done <"$PHASE_FILE_PATH"
|
|
fi
|
|
|
|
echo -n "$STDIN$output"
|
|
}
|
|
|
|
trigger-docker-options-docker-args "$@"
|