From 16aa0439a490316b1dec869b4f1c828a72aa0db9 Mon Sep 17 00:00:00 2001 From: snoe925 Date: Mon, 11 Nov 2019 14:48:51 -0600 Subject: [PATCH] Pass APT_PROXY into Docker run If APT_PROXY is defined, pass down into the Docker as an environment variable. --- build-docker.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build-docker.sh b/build-docker.sh index 79b68d4..a9a2ce3 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -14,6 +14,11 @@ if ! ${DOCKER} ps >/dev/null; then exit 1 fi +# Pass APT_PROXY into Docker run environment +if test -n "$APT_PROXY"; then + DOCKER_APT_PROXY="-e APT_PROXY=$APT_PROXY" +fi + CONFIG_FILE="" if [ -f "${DIR}/config" ]; then CONFIG_FILE="${DIR}/config" @@ -78,7 +83,7 @@ if [ "${CONTAINER_EXISTS}" != "" ]; then trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM time ${DOCKER} run --rm --privileged \ --volume "${CONFIG_FILE}":/config:ro \ - -e "GIT_HASH=${GIT_HASH}" \ + -e "GIT_HASH=${GIT_HASH}" ${DOCKER_APT_PROXY} \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && @@ -89,7 +94,7 @@ else trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \ --volume "${CONFIG_FILE}":/config:ro \ - -e "GIT_HASH=${GIT_HASH}" \ + -e "GIT_HASH=${GIT_HASH}" ${DOCKER_APT_PROXY} \ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && cd /pi-gen; ./build.sh ${BUILD_OPTS} &&