[Sound-open-firmware] [PATCH V2 1/2] scripts: docker: Add proxy settings

Xiuli Pan xiuli.pan at linux.intel.com
Tue Jun 5 12:43:26 CEST 2018


From: Pan Xiuli <xiuli.pan at linux.intel.com>

Modify Dockerfile to copy apt.conf from host and set host proxy to
environment. Also modify some git url to http url in order to use the
proxy.

Also add a docker-build.sh to help docker build

Signed-off-by: Pan Xiuli <xiuli.pan at linux.intel.com>
---
V2: Add selection to use git url when no proxy is used
---
 scripts/README.docker                |  3 ++-
 scripts/docker_build/Dockerfile      | 23 ++++++++++++++++++-----
 scripts/docker_build/docker-build.sh |  7 +++++++
 3 files changed, 27 insertions(+), 6 deletions(-)
 create mode 100755 scripts/docker_build/docker-build.sh

diff --git a/scripts/README.docker b/scripts/README.docker
index 82558b1..e2f189f 100644
--- a/scripts/README.docker
+++ b/scripts/README.docker
@@ -16,7 +16,8 @@ First, build the docker container. This step needs to be done initially and
 when the toolchain or alsa dependencies are updated.
 
 cd scripts/docker_build
-docker build --build-arg UID=$(id -u) -t sof .
+
+./docker-build.sh
 
 After the container is built, it can be used to run the scripts.
 
diff --git a/scripts/docker_build/Dockerfile b/scripts/docker_build/Dockerfile
index 7ee0a45..8dede3c 100644
--- a/scripts/docker_build/Dockerfile
+++ b/scripts/docker_build/Dockerfile
@@ -17,6 +17,13 @@
 FROM ubuntu:16.04
 ARG UID=1000
 
+# Set up proxy from host
+COPY apt.conf /etc/apt/
+ARG host_http_proxy
+ARG host_https_proxy
+ENV http_proxy $host_http_proxy
+ENV https_proxy $host_https_proxy
+
 RUN apt-get -y update && \
 	    apt-get install -y \
 	    	autoconf \
@@ -49,11 +56,17 @@ RUN apt-get clean
 RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
 
 # Use ToT alsa utils for the latest topology patches.
-RUN mkdir -p /root/alsa-build
-RUN cd /root/alsa-build && git clone git://git.alsa-project.org/alsa-lib.git
-RUN cd /root/alsa-build && git clone git://git.alsa-project.org/alsa-utils.git
-RUN cd /root/alsa-build/alsa-lib && ./gitcompile &&  make install
-RUN cd /root/alsa-build/alsa-utils && ./gitcompile &&  make install
+RUN mkdir -p /root/alsa-build && cd /root/alsa-build && \
+	if [ "x$http_proxy" = "x" ]; then \
+		git clone git://git.alsa-project.org/alsa-lib.git && \
+		git clone git://git.alsa-project.org/alsa-utils.git ; \
+	else \
+		git clone http://git.alsa-project.org/http/alsa-lib.git && \
+		git clone http://git.alsa-project.org/http/alsa-utils.git; \
+	fi && \
+cd /root/alsa-build/alsa-lib && ./gitcompile &&  make install && \
+cd /root/alsa-build/alsa-utils && ./gitcompile &&  make install && \
+cd /root/ && rm -rf alsa-build
 
 RUN useradd --create-home -d /home/sof -u $UID -G sudo sof
 RUN echo "sof:test0000" | chpasswd
diff --git a/scripts/docker_build/docker-build.sh b/scripts/docker_build/docker-build.sh
new file mode 100755
index 0000000..1090f15
--- /dev/null
+++ b/scripts/docker_build/docker-build.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+if [ -f "/etc/apt/apt.conf" ]; then
+	cp /etc/apt/apt.conf ./
+else
+	touch apt.conf
+fi
+docker build --build-arg UID=$(id -u) --build-arg host_http_proxy=$http_proxy --build-arg host_https_proxy=$https_proxy -t sof .
-- 
2.7.4



More information about the Sound-open-firmware mailing list