Skip to content

Commit

Permalink
[build]: add the support of Apt-Cacher-NG proxy configuration to the …
Browse files Browse the repository at this point in the history
…slave docker build script (#3256)

Signed-off-by: wangshengjun <wangshengjun@asterfusion.com>
  • Loading branch information
wangshengjun committed Aug 9, 2019
1 parent 3e6e037 commit ef5064f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ DOCKER_BASE_BUILD = docker build --no-cache \
-t $(SLAVE_BASE_IMAGE):$(SLAVE_BASE_TAG) \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
--build-arg apt_cacher_ng_proxy=$(apt_cacher_ng_proxy) \
$(SLAVE_DIR)

DOCKER_BUILD = docker build --no-cache \
Expand All @@ -149,6 +150,7 @@ DOCKER_BUILD = docker build --no-cache \
--build-arg guid=$(shell id -g) \
--build-arg hostname=$(shell echo $$HOSTNAME) \
--build-arg slave_base_tag_ref=$(SLAVE_BASE_TAG) \
--build-arg apt_cacher_ng_proxy=$(apt_cacher_ng_proxy) \
-t $(SLAVE_IMAGE):$(SLAVE_TAG) \
-f $(SLAVE_DIR)/Dockerfile.user \
$(SLAVE_DIR)
Expand All @@ -173,6 +175,7 @@ SONIC_BUILD_INSTRUCTION := make \
KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \
HTTP_PROXY=$(http_proxy) \
HTTPS_PROXY=$(https_proxy) \
APT_CACHER_NG_PROXY=$(apt_cacher_ng_proxy) \
SONIC_ENABLE_SYSTEM_TELEMETRY=$(ENABLE_SYSTEM_TELEMETRY) \
EXTRA_JESSIE_TARGETS=$(EXTRA_JESSIE_TARGETS) \
$(SONIC_OVERRIDE_BUILD_VARS)
Expand Down
4 changes: 4 additions & 0 deletions dockers/docker-base-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ RUN while [ -n "$(find /usr/share/doc -depth -type d -empty -print -exec rmdir {
/var/cache/man/* \
/usr/share/locale/*

{% if APT_CACHER_NG_PROXY.strip() -%}
RUN echo 'Acquire::http::Proxy "{{APT_CACHER_NG_PROXY}}";' >> /etc/apt/apt.conf.d/02proxy
{%- endif %}

# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

Expand Down
4 changes: 4 additions & 0 deletions dockers/docker-base/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ RUN rm -rf \
/var/cache/man/* \
/usr/share/locale/*

{% if APT_CACHER_NG_PROXY.strip() -%}
RUN echo 'Acquire::http::Proxy "{{APT_CACHER_NG_PROXY}}";' >> /etc/apt/apt.conf.d/02proxy
{%- endif %}

# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

Expand Down
1 change: 1 addition & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ $(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)")
$(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)")
$(info "HTTP_PROXY" : "$(HTTP_PROXY)")
$(info "HTTPS_PROXY" : "$(HTTPS_PROXY)")
$(info "APT_CACHER_NG_PROXY" : "$(APT_CACHER_NG_PROXY)")
$(info "ENABLE_SYSTEM_TELEMETRY" : "$(ENABLE_SYSTEM_TELEMETRY)")
$(info "SONIC_DEBUGGING_ON" : "$(SONIC_DEBUGGING_ON)")
$(info "SONIC_PROFILING_ON" : "$(SONIC_PROFILING_ON)")
Expand Down
4 changes: 4 additions & 0 deletions sonic-slave-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ RUN echo "deb [arch=arm64] http://deb.debian.org/debian stretch main contrib non
echo 'deb [arch=arm64] http://ftp.debian.org/debian stretch-backports main' >> /etc/apt/sources.list
{%- endif %}


ARG apt_cacher_ng_proxy
RUN echo "Acquire::http::Proxy \"$apt_cacher_ng_proxy\";" >> /etc/apt/apt.conf.d/02proxy

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

Expand Down
3 changes: 3 additions & 0 deletions sonic-slave/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ RUN echo "deb [arch=arm64] http://archive.debian.org/debian jessie main contrib
echo "deb [arch=arm64] http://archive.debian.org/debian jessie-backports main contrib non-free" >> /etc/apt/sources.list
{% endif %}

ARG apt_cacher_ng_proxy
RUN echo "Acquire::http::Proxy \"$apt_cacher_ng_proxy\";" >> /etc/apt/apt.conf.d/02proxy

## Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive

Expand Down

0 comments on commit ef5064f

Please # to comment.