diff --git a/Makefile b/Makefile index 71bbf7b0..1b944314 100644 --- a/Makefile +++ b/Makefile @@ -81,14 +81,46 @@ SUPERVISOR_EXTRA_MOUNTS = clean: -rm Dockerfile -supervisor-dind: +DOCKERD_PROXY=tools/dind/config/services/docker.service.d/proxy.conf +${DOCKERD_PROXY}: + rm -f ${DOCKERD_PROXY} + if [ -n "${rt_http_proxy}" ]; then \ + proxies=("\"HTTP_PROXY=${rt_http_proxy}\""); \ + proxies=($${proxies[*]} "\"http_proxy=${rt_http_proxy}\""); \ + fi; \ + if [ -n "${rt_https_proxy}" ]; then \ + proxies=($${proxies[*]} "\"HTTPS_PROXY=${rt_https_proxy}\""); \ + proxies=($${proxies[*]} "\"https_proxy=${rt_https_proxy}\""); \ + fi; \ + if [ -n "${rt_no_proxy}" ]; then \ + proxies=($${proxies[*]} "\"no_proxy=${rt_no_proxy}\""); \ + fi; \ + if [ -n "$${proxies[*]}" ]; then \ + echo "[Service]" > ${DOCKERD_PROXY}; \ + echo "Environment=$${proxies[*]}" >> ${DOCKERD_PROXY}; \ + else \ + touch ${DOCKERD_PROXY}; \ + fi + +supervisor-dind: ${DOCKERD_PROXY} cd tools/dind && docker build $(DOCKER_HTTP_PROXY) $(DOCKER_HTTPS_PROXY) $(DOCKER_NO_PROXY) --no-cache=$(DISABLE_CACHE) --build-arg PASSWORDLESS_DROPBEAR=$(PASSWORDLESS_DROPBEAR) -t resin/resin-supervisor-dind:$(SUPERVISOR_VERSION) . -run-supervisor: supervisor-dind stop-supervisor +run-supervisor: stop-supervisor supervisor-dind cd tools/dind \ && echo "SUPERVISOR_IMAGE=$(SUPERVISOR_IMAGE)" > config/localenv \ && echo "PRELOADED_IMAGE=$(PRELOADED_IMAGE)" >> config/localenv \ - && echo "SUPERVISOR_EXTRA_MOUNTS=$(SUPERVISOR_EXTRA_MOUNTS)" >> config/localenv \ + && echo "SUPERVISOR_EXTRA_MOUNTS=$(SUPERVISOR_EXTRA_MOUNTS)" >> config/localenv; \ + if [ -n "$(rt_http_proxy)" ]; then \ + echo "HTTP_PROXY=$(rt_http_proxy)" >> config/localenv \ + && echo "http_proxy=$(rt_http_proxy)" >> config/localenv; \ + fi; \ + if [ -n "$(rt_https_proxy)" ]; then \ + echo "HTTPS_PROXY=$(rt_https_proxy)" >> config/localenv \ + && echo "https_proxy=$(rt_https_proxy)" >> config/localenv; \ + fi; \ + if [ -n "$(rt_no_proxy)" ]; then \ + echo "no_proxy=$(rt_no_proxy)" >> config/localenv; \ + fi \ && docker run -d --name resin_supervisor_1 --privileged ${SUPERVISOR_DIND_MOUNTS} resin/resin-supervisor-dind:$(SUPERVISOR_VERSION) stop-supervisor: