ajouter le support des proxies
This commit is contained in:
parent
c838581ac2
commit
0673acfc3a
|
@ -58,6 +58,7 @@ IMAGENAME=
|
||||||
function eecho() { echo "$*" 1>&2; }
|
function eecho() { echo "$*" 1>&2; }
|
||||||
function eerror() { eecho "ERROR: $*"; }
|
function eerror() { eecho "ERROR: $*"; }
|
||||||
function die() { [ $# -gt 0 ] && eerror "$*"; exit 1; }
|
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 in_path() { [ -n "$1" -a -x "$(which "$1" 2>/dev/null)" ]; }
|
||||||
function composer() {
|
function composer() {
|
||||||
cd "$PROJDIR/$COMPOSERDIR" || exit 1
|
cd "$PROJDIR/$COMPOSERDIR" || exit 1
|
||||||
|
@ -122,6 +123,12 @@ if [ -z "$_RUNDK_IN_DOCKER" ]; then
|
||||||
############################################################################
|
############################################################################
|
||||||
# Lancement depuis l'extérieur du container
|
# 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
|
## Charger ~/.dkbuild.env
|
||||||
|
|
||||||
APT_PROXY=
|
APT_PROXY=
|
||||||
|
@ -298,6 +305,12 @@ OPTIONS
|
||||||
for arg in "${BUILD_ARGS[@]}"; do
|
for arg in "${BUILD_ARGS[@]}"; do
|
||||||
args+=(--build-arg "$arg=${!arg}")
|
args+=(--build-arg "$arg=${!arg}")
|
||||||
done
|
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
|
mkdir -p /tmp/rundk-build
|
||||||
docker build "${args[@]}" /tmp/rundk-build || exit 1
|
docker build "${args[@]}" /tmp/rundk-build || exit 1
|
||||||
|
|
||||||
|
@ -363,6 +376,9 @@ OPTIONS
|
||||||
-e _RUNDK_UID="$uid"
|
-e _RUNDK_UID="$uid"
|
||||||
-e _RUNDK_GID="$gid"
|
-e _RUNDK_GID="$gid"
|
||||||
)
|
)
|
||||||
|
for arg in "${!PROXY_VARS[@]}"; do
|
||||||
|
args+=(--e "$arg=${PROXY_VARS[$arg]}")
|
||||||
|
done
|
||||||
for host in "${HOST_MAPPINGS[@]}"; do
|
for host in "${HOST_MAPPINGS[@]}"; do
|
||||||
args+=(--add-host "$host")
|
args+=(--add-host "$host")
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue