ajouter le support des proxies

This commit is contained in:
Jephté Clain 2024-03-27 19:40:54 +04:00
parent c838581ac2
commit 0673acfc3a
1 changed files with 16 additions and 0 deletions

View File

@ -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