Skip to content

Commit

Permalink
Add Python3 packages to sonic-mgmt-docker (#15726)
Browse files Browse the repository at this point in the history
Why I did it
This is part of sonic-mgmt-docker Python3 migration project.
Currently Python3 packages are in the Python3 virtual environment. This PR will add Python3 packages to real file system.
After we migrate all script to use Python3 in real file system, the Python3 venv will be deleted.

After this PR, in sonic-mgmt-docker,
Directly run cmd - pytest will use Python2's version.
python3 -m pytest will use Python3's version.

How I did it
Modify sonic-mgmt-docker j2 script.

How to verify it
Build a private sonic-mgmt-docker and run basic test case with Python3.
  • Loading branch information
wsycqyz authored Jul 11, 2023
1 parent 72021fd commit c589230
Showing 1 changed file with 75 additions and 12 deletions.
87 changes: 75 additions & 12 deletions dockers/docker-sonic-mgmt/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,80 @@ RUN apt-get update && apt-get install -y apt-transport-https \
telnet \
vim

RUN pip3 install --upgrade pip setuptools wheel
RUN pip3 install aiohttp \
allure-pytest==2.8.22 \
ansible==2.9.27 \
azure-storage-blob==12.9.0 \
azure-kusto-data \
azure-kusto-ingest \
defusedxml \
celery[redis]==4.4.7 \
cffi \
contextlib2==0.6.0.post1 \
cryptography==3.3.2 \
dpkt \
"future>=0.16.0" \
gitpython \
ipaddr \
ipython==5.4.1 \
ixnetwork-restpy==1.0.64 \
ixnetwork-open-traffic-generator==0.0.79 \
jinja2==2.10.1 \
jsonpatch \
lxml \
markupsafe==2.0.1 \
mock \
msrest==0.6.21 \
natsort \
ncclient \
netaddr \
netmiko==2.4.2 \
paramiko==2.7.1 \
passlib \
pexpect \
prettytable \
psutil \
ptf \
pyasn1==0.4.8 \
pycryptodome==3.9.8 \
pyfiglet \
pylint==1.8.1 \
pyro4 \
pysnmp==4.4.12 \
pysubnettree \
pytest-ansible \
pytest-html \
pytest-repeat \
pytest-xdist==1.28.0 \
python-dateutil \
pytest==7.1.3 \
redis \
requests \
retry \
rpyc \
scandir \
scapy==2.4.5 \
setuptools-rust \
six \
snappi[ixnetwork,convergence]==0.7.44 \
tabulate \
textfsm==1.1.2 \
thrift==0.11.0 \
virtualenv \
&& wget https://github.com/nanomsg/nanomsg/archive/1.2.tar.gz \
&& tar xvfz 1.2.tar.gz \
&& cd nanomsg-1.2 \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make install \
&& ldconfig \
&& cd ../.. \
&& rm -fr nanomsg-1.2 \
&& rm -f 1.2.tar.gz \
&& pip3 install nnpy

RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \
--output python-scapy_2.3.3-3_all.deb \
&& dpkg -i python-scapy_2.3.3-3_all.deb \
Expand Down Expand Up @@ -72,6 +146,7 @@ RUN pip install allure-pytest==2.8.22 \
natsort \
netaddr \
netmiko==2.4.2 \
nnpy \
paramiko==2.7.1 \
passlib \
pexpect \
Expand Down Expand Up @@ -108,18 +183,6 @@ RUN pip install allure-pytest==2.8.22 \
&& python setup.py install \
&& cd .. \
&& rm -fr scapy-vxlan \
&& wget https://github.com/nanomsg/nanomsg/archive/1.0.0.tar.gz \
&& tar xvfz 1.0.0.tar.gz \
&& cd nanomsg-1.0.0 \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make install \
&& ldconfig \
&& cd ../.. \
&& rm -fr nanomsg-1.0.0 \
&& rm -f 1.0.0.tar.gz \
&& pip install nnpy \
&& pip install scapy==2.4.5 --upgrade --ignore-installed

# Install docker-ce-cli
Expand Down

0 comments on commit c589230

Please sign in to comment.