diff --git a/support/rundk b/support/rundk index d6ca6c4..adf2ded 100755 --- a/support/rundk +++ b/support/rundk @@ -58,6 +58,7 @@ IMAGENAME= function eecho() { echo "$*" 1>&2; } function eerror() { eecho "ERROR: $*"; } function die() { [ $# -gt 0 ] && eerror "$*"; exit 1; } +function is_defined() { [ -n "$(declare -p "$1" 2>/dev/null)" ]; } function in_path() { [ -n "$1" -a -x "$(which "$1" 2>/dev/null)" ]; } function composer() { cd "$PROJDIR/$COMPOSERDIR" || exit 1 @@ -122,6 +123,12 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then ############################################################################ # Lancement depuis l'extérieur du container + # recenser les valeur de proxy + declare -A PROXY_VARS + for var in {HTTPS,ALL,NO}_PROXY {http,https,all,no}_proxy; do + is_defined "$var" && PROXY_VARS[${var,,}]="${!var}" + done + ## Charger ~/.dkbuild.env APT_PROXY= @@ -298,6 +305,12 @@ OPTIONS for arg in "${BUILD_ARGS[@]}"; do args+=(--build-arg "$arg=${!arg}") done + for arg in "${!PROXY_VARS[@]}"; do + args+=(--build-arg "$arg=${PROXY_VARS[$arg]}") + done + for host in "${HOST_MAPPINGS[@]}"; do + args+=(--add-host "$host") + done mkdir -p /tmp/rundk-build docker build "${args[@]}" /tmp/rundk-build || exit 1 @@ -363,6 +376,9 @@ OPTIONS -e _RUNDK_UID="$uid" -e _RUNDK_GID="$gid" ) + for arg in "${!PROXY_VARS[@]}"; do + args+=(--e "$arg=${PROXY_VARS[$arg]}") + done for host in "${HOST_MAPPINGS[@]}"; do args+=(--add-host "$host") done