From 6fbd52b1c1c3ff3bf23af1c09f6ca52a515cbc1f Mon Sep 17 00:00:00 2001 From: lguohan Date: Mon, 4 Jan 2021 21:57:58 -0800 Subject: [PATCH] [docker-sonic-vs]: reduce the build steps for docker-sonic-vs (#6350) combine multiple same operation into one operation to reduce the build steps. this is to avoid max depth exceeded issue in the build. Signed-off-by: Guohan Lu --- platform/vs/docker-sonic-vs/Dockerfile.j2 | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index a9f05f9b74..837e8fc3cb 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -101,33 +101,23 @@ RUN pip3 install \ {% if docker_sonic_vs_debs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_sonic_vs_debs.split(' ') %} -COPY debs/{{ deb }} /debs/ -{%- endfor %} +COPY {%- for deb in docker_sonic_vs_debs.split(' ') %} debs/{{ deb }}{%- endfor %} /debs/ # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_sonic_vs_debs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; {%- for deb in docker_sonic_vs_debs.split(' ') %} dpkg_apt /debs/{{ deb }};{%- endfor %} {%- endif %} {% if docker_sonic_vs_pydebs.strip() -%} # Copy locally-built Debian package dependencies -{%- for deb in docker_sonic_vs_pydebs.split(' ') %} -COPY python-debs/{{ deb }} /debs/ -{%- endfor %} +COPY {%- for deb in docker_sonic_vs_pydebs.split(' ') %} python-debs/{{ deb }}{%- endfor %} /debs/ # Install locally-built Debian packages and implicitly install their dependencies -{%- for deb in docker_sonic_vs_pydebs.split(' ') %} -RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; dpkg_apt /debs/{{ deb }} -{%- endfor %} +RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return 1; }; {%- for deb in docker_sonic_vs_pydebs.split(' ') %} dpkg_apt /debs/{{ deb }};{%- endfor %} {%- endif %} {% if docker_sonic_vs_whls.strip() %} # copy all whl PKGs first, -{% for whl in docker_sonic_vs_whls.split(' ') -%} -COPY python-wheels/{{ whl }} python-wheels/ -{% endfor %} +copy {%- for whl in docker_sonic_vs_whls.split(' ') %} python-wheels/{{ whl }}{%- endfor %} python-wheels/ # install PKGs after copying all PKGs to avoid dependency failure # use py3 to find python3 package, which is forced by wheel as of now