diff --git a/platform/vs/docker-sonic-vs.mk b/platform/vs/docker-sonic-vs.mk index 718534231689..43310073b65d 100644 --- a/platform/vs/docker-sonic-vs.mk +++ b/platform/vs/docker-sonic-vs.mk @@ -13,6 +13,9 @@ $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS) \ $(DOCKER_SONIC_VS)_PYTHON_DEBS += $(SONIC_UTILS) +$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SONIC_YANG_MODELS_PY3) +$(DOCKER_SONIC_VS)_PYTHON_WHEELS += $(SONIC_YANG_MGMT_PY) + ifeq ($(INSTALL_DEBUG_TOOLS), y) $(DOCKER_SONIC_VS)_DEPENDS += $(SWSS_DBG) \ $(LIBSWSSCOMMON_DBG) \ diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index f7c88c9b833a..2b3252534bcb 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -45,7 +45,8 @@ RUN apt-get install -y net-tools \ tcpdump \ python-scapy \ conntrack \ - iptables + iptables \ + python3-pip RUN pip install setuptools RUN pip install py2_ipaddress @@ -77,6 +78,23 @@ RUN dpkg_apt() { [ -f $1 ] && { dpkg -i $1 || apt-get -y install -f; } || return {%- 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 %} + +# install PKGs after copying all PKGs to avoid dependency failure +# use py3 to find python3 package, which is forced by wheel as of now +{%- for whl in docker_sonic_vs_whls.split(' ') %} +{%- if 'py3' in whl %} +RUN pip3 install python-wheels/{{ whl }} +{% else -%} +RUN pip install python-wheels/{{ whl }} +{%- endif %} +{%- endfor %} +{% endif %} + # Clean up RUN apt-get clean -y RUN apt-get autoclean -y