feat: export environment variables during dockerfile builds for use with value-less --build-arg flags

Exposing all config values will allow users to skip setting environment variables twice - once as a docker option and once as an env var. Docker will automatically pull the value from the environment if none is set for the --build-arg flag.

Users will still be required to specify each desired env var via --build-arg as otherwise docker builds will complain about unused build arguments.

Re-implements #5978 (lost in a rebase)
Closes #5903
This commit is contained in:
Jose Diaz-Gonzalez
2023-07-01 06:45:21 -04:00
parent b8680f7de7
commit 94f4d1325c
3 changed files with 21 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ trigger-builder-dockerfile-builder-build() {
declare -a ARG_ARRAY
eval "ARG_ARRAY=($DOCKER_ARGS)"
eval "$(config_export app "$APP")"
"$DOCKER_BIN" image build "${DOCKER_BUILD_LABEL_ARGS[@]}" $DOKKU_GLOBAL_BUILD_ARGS "${ARG_ARRAY[@]}" ${DOKKU_DOCKER_BUILD_OPTS} -t $IMAGE .
plugn trigger post-build-dockerfile "$APP"