Pass APT_PROXY into Docker run

If APT_PROXY is defined, pass down into the Docker as an environment variable.
This commit is contained in:
snoe925 2019-11-11 14:48:51 -06:00 committed by GitHub
parent a449c75fac
commit 16aa0439a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,11 @@ if ! ${DOCKER} ps >/dev/null; then
exit 1 exit 1
fi 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="" CONFIG_FILE=""
if [ -f "${DIR}/config" ]; then if [ -f "${DIR}/config" ]; then
CONFIG_FILE="${DIR}/config" 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 trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}_cont' SIGINT SIGTERM
time ${DOCKER} run --rm --privileged \ time ${DOCKER} run --rm --privileged \
--volume "${CONFIG_FILE}":/config:ro \ --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" \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \
pi-gen \ pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && 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 trap 'echo "got CTRL+C... please wait 5s" && ${DOCKER} stop -t 5 ${CONTAINER_NAME}' SIGINT SIGTERM
time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \ time ${DOCKER} run --name "${CONTAINER_NAME}" --privileged \
--volume "${CONFIG_FILE}":/config:ro \ --volume "${CONFIG_FILE}":/config:ro \
-e "GIT_HASH=${GIT_HASH}" \ -e "GIT_HASH=${GIT_HASH}" ${DOCKER_APT_PROXY} \
pi-gen \ pi-gen \
bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static &&
cd /pi-gen; ./build.sh ${BUILD_OPTS} && cd /pi-gen; ./build.sh ${BUILD_OPTS} &&