Improve compatibility with firewalled networks

* Allow specifying MBEDTLS_DOCKER_REGISTRY for organizations that have
  a mirroring proxy of Docker Hub
* Specify "--network host" during build to ensure use of the host's
  DNS resolution.
This commit is contained in:
Peter Kolbus 2019-06-29 11:26:51 -05:00
parent be54358fa7
commit 718c74ca85
2 changed files with 10 additions and 4 deletions

View file

@ -21,10 +21,11 @@
# limitations under the License. # limitations under the License.
# #
# This file is part of Mbed TLS (https://tls.mbed.org) # This file is part of Mbed TLS (https://tls.mbed.org)
FROM ubuntu:bionic
ARG MAKEFLAGS_PARALLEL="" ARG MAKEFLAGS_PARALLEL=""
ARG MY_REGISTRY=
FROM ${MY_REGISTRY}ubuntu:bionic
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive

View file

@ -14,7 +14,10 @@
# This script expects a Linux x86_64 system with a recent version of Docker # This script expects a Linux x86_64 system with a recent version of Docker
# installed and available for use, as well as http/https access. If a proxy # installed and available for use, as well as http/https access. If a proxy
# server must be used, invoke this script with the usual environment variables # server must be used, invoke this script with the usual environment variables
# (http_proxy and https_proxy) set appropriately. # (http_proxy and https_proxy) set appropriately. If an alternate Docker
# registry is needed, specify MBEDTLS_DOCKER_REGISTRY to point at the
# host name.
#
# #
# Running this script directly will check for Docker availability and set up # Running this script directly will check for Docker availability and set up
# the Docker image. # the Docker image.
@ -63,8 +66,10 @@ ${DOCKER} image build \
-t ${DOCKER_IMAGE_TAG} \ -t ${DOCKER_IMAGE_TAG} \
--cache-from=${DOCKER_IMAGE_TAG} \ --cache-from=${DOCKER_IMAGE_TAG} \
--build-arg MAKEFLAGS_PARALLEL="-j $(nproc)" \ --build-arg MAKEFLAGS_PARALLEL="-j $(nproc)" \
--network host \
${http_proxy+--build-arg http_proxy=${http_proxy}} \ ${http_proxy+--build-arg http_proxy=${http_proxy}} \
${https_proxy+--build-arg https_proxy=${https_proxy}} \ ${https_proxy+--build-arg https_proxy=${https_proxy}} \
${MBEDTLS_DOCKER_REGISTRY+--build-arg MY_REGISTRY="${MBEDTLS_DOCKER_REGISTRY}/"} \
tests/docker/${MBEDTLS_DOCKER_GUEST} tests/docker/${MBEDTLS_DOCKER_GUEST}
run_in_docker() run_in_docker()