[docker-sonic-mgmt] Cleanup and upgrade some packages (#12218)
Why I did it The Dockerfile of docker-sonic-mgmt became a little bit messy over time. Some packages are also a little bit too old. It would be better to do some cleanup and upgrade some important packages. How I did it Updated the dockerfile template for building docker-sonic-mgmt. How to verify it Locally built the docker-sonic-mgmt image and used it to run some test scripts. Description for the changelog: The build-essential package contains gcc and make. It's unnecessary to install them again. The python-is-python2 package is included in the python package for Ubuntu 20.04. It's unnecessary to install it again. Sort the apt and pip packages by alphabetic order. Cleanup get-pip.py after installation. Cleanup the python-scapy deb package after installation. Ensure that the python pip, setuptools and wheel packages are up to date. Install pytest-ansible from pip instead of from source code. While installing docker-ce-cli, it's unnecessary to install curl and software-properties-common again. Merged some pip install steps into one step. Upgrade ansible from 2.8.12 to 2.9.27 for env-python3. Upgrade pytest to 7.1.3 for env-python3. Add ncclient package to evn-python3.
This commit is contained in:
parent
dc2cc9d507
commit
a07aaca831
@ -7,7 +7,6 @@ RUN apt-get update && apt-get install -y build-essential \
|
|||||||
cmake \
|
cmake \
|
||||||
curl \
|
curl \
|
||||||
default-jre \
|
default-jre \
|
||||||
gcc \
|
|
||||||
git \
|
git \
|
||||||
inetutils-ping \
|
inetutils-ping \
|
||||||
iproute2 \
|
iproute2 \
|
||||||
@ -16,7 +15,6 @@ RUN apt-get update && apt-get install -y build-essential \
|
|||||||
libssl-dev \
|
libssl-dev \
|
||||||
libxml2 \
|
libxml2 \
|
||||||
libxslt1-dev \
|
libxslt1-dev \
|
||||||
make \
|
|
||||||
openssh-server \
|
openssh-server \
|
||||||
psmisc \
|
psmisc \
|
||||||
python \
|
python \
|
||||||
@ -25,36 +23,43 @@ RUN apt-get update && apt-get install -y build-essential \
|
|||||||
python3-venv \
|
python3-venv \
|
||||||
rsyslog \
|
rsyslog \
|
||||||
snmp \
|
snmp \
|
||||||
|
software-properties-common \
|
||||||
sshpass \
|
sshpass \
|
||||||
sudo \
|
sudo \
|
||||||
tcpdump \
|
tcpdump \
|
||||||
telnet \
|
telnet \
|
||||||
vim \
|
vim
|
||||||
python-is-python2 \
|
|
||||||
software-properties-common
|
|
||||||
|
|
||||||
RUN add-apt-repository -y universe
|
RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \
|
||||||
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \
|
|
||||||
&& python2 get-pip.py
|
|
||||||
|
|
||||||
RUN curl -L 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 \
|
--output python-scapy_2.3.3-3_all.deb \
|
||||||
&& dpkg -i python-scapy_2.3.3-3_all.deb
|
&& dpkg -i python-scapy_2.3.3-3_all.deb \
|
||||||
|
&& rm -f python-scapy_2.3.3-3_all.deb
|
||||||
|
|
||||||
RUN pip install setuptools==44.1.1
|
RUN curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \
|
||||||
RUN pip install cffi==1.12.0 \
|
&& python2 get-pip.py \
|
||||||
|
&& rm -f get-pip.py \
|
||||||
|
&& ln -sf `which pip2` /usr/bin/pip
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip setuptools wheel
|
||||||
|
RUN pip install allure-pytest==2.8.22 \
|
||||||
|
ansible==2.8.12 \
|
||||||
|
azure-storage-blob==12.9.0 \
|
||||||
|
celery[redis]==4.4.7 \
|
||||||
|
cffi==1.12.0 \
|
||||||
contextlib2==0.6.0.post1 \
|
contextlib2==0.6.0.post1 \
|
||||||
cryptography==3.3.2 \
|
cryptography==3.3.2 \
|
||||||
|
dpkt \
|
||||||
"future>=0.16.0" \
|
"future>=0.16.0" \
|
||||||
gitpython \
|
gitpython \
|
||||||
ipaddr \
|
ipaddr \
|
||||||
ipython==5.4.1 \
|
ipython==5.4.1 \
|
||||||
ixnetwork-restpy==1.0.64 \
|
ixnetwork-restpy==1.0.64 \
|
||||||
ixnetwork-open-traffic-generator==0.0.79 \
|
ixnetwork-open-traffic-generator==0.0.79 \
|
||||||
snappi[ixnetwork,convergence]==0.7.44 \
|
|
||||||
jinja2==2.7.2 \
|
jinja2==2.7.2 \
|
||||||
jsonpatch \
|
jsonpatch \
|
||||||
|
lazy-object-proxy==1.6.0 \
|
||||||
lxml \
|
lxml \
|
||||||
|
msrest==0.6.21 \
|
||||||
natsort \
|
natsort \
|
||||||
netaddr \
|
netaddr \
|
||||||
netmiko==2.4.2 \
|
netmiko==2.4.2 \
|
||||||
@ -64,30 +69,29 @@ RUN pip install cffi==1.12.0 \
|
|||||||
prettytable \
|
prettytable \
|
||||||
psutil \
|
psutil \
|
||||||
pyasn1==0.1.9 \
|
pyasn1==0.1.9 \
|
||||||
|
pycryptodome==3.9.8 \
|
||||||
pyfiglet \
|
pyfiglet \
|
||||||
lazy-object-proxy==1.6.0 \
|
|
||||||
pylint==1.8.1 \
|
pylint==1.8.1 \
|
||||||
pyro4 \
|
pyro4 \
|
||||||
pysnmp==4.2.5 \
|
pysnmp==4.2.5 \
|
||||||
|
pysubnettree \
|
||||||
|
pytest==4.6.11 \
|
||||||
|
pytest-ansible \
|
||||||
pytest-repeat \
|
pytest-repeat \
|
||||||
pytest-html \
|
pytest-html \
|
||||||
pytest-xdist==1.28.0 \
|
pytest-xdist==1.28.0 \
|
||||||
pytest==4.6.5 \
|
python-dateutil \
|
||||||
redis \
|
redis \
|
||||||
requests \
|
requests \
|
||||||
|
retry \
|
||||||
rpyc \
|
rpyc \
|
||||||
six \
|
six \
|
||||||
tabulate \
|
snappi[ixnetwork,convergence]==0.7.44 \
|
||||||
statistics \
|
statistics \
|
||||||
textfsm==1.1.2 \
|
tabulate \
|
||||||
virtualenv \
|
textfsm==1.1.3 \
|
||||||
retry \
|
|
||||||
thrift==0.11.0 \
|
thrift==0.11.0 \
|
||||||
allure-pytest==2.8.22 \
|
virtualenv \
|
||||||
celery[redis]==4.4.7 \
|
|
||||||
msrest==0.6.21 \
|
|
||||||
python-dateutil \
|
|
||||||
azure-storage-blob==12.9.0 \
|
|
||||||
&& git clone https://github.com/p4lang/scapy-vxlan.git \
|
&& git clone https://github.com/p4lang/scapy-vxlan.git \
|
||||||
&& cd scapy-vxlan \
|
&& cd scapy-vxlan \
|
||||||
&& python setup.py install \
|
&& python setup.py install \
|
||||||
@ -104,8 +108,7 @@ RUN pip install cffi==1.12.0 \
|
|||||||
&& cd ../.. \
|
&& cd ../.. \
|
||||||
&& rm -fr nanomsg-1.0.0 \
|
&& rm -fr nanomsg-1.0.0 \
|
||||||
&& rm -f 1.0.0.tar.gz \
|
&& rm -f 1.0.0.tar.gz \
|
||||||
&& pip install nnpy \
|
&& pip install nnpy \
|
||||||
&& pip install dpkt \
|
|
||||||
&& pip install scapy==2.4.5 --upgrade --ignore-installed
|
&& pip install scapy==2.4.5 --upgrade --ignore-installed
|
||||||
|
|
||||||
# Install docker-ce-cli
|
# Install docker-ce-cli
|
||||||
@ -113,9 +116,7 @@ RUN apt-get update \
|
|||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
|
||||||
gnupg-agent \
|
gnupg-agent \
|
||||||
software-properties-common \
|
|
||||||
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
|
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
|
||||||
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
@ -124,8 +125,6 @@ RUN apt-get update \
|
|||||||
# Install Azure CLI
|
# Install Azure CLI
|
||||||
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
||||||
|
|
||||||
RUN pip install wheel==0.33.6
|
|
||||||
|
|
||||||
## Copy and install sonic-mgmt docker dependencies
|
## Copy and install sonic-mgmt docker dependencies
|
||||||
COPY \
|
COPY \
|
||||||
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
||||||
@ -138,18 +137,6 @@ RUN dpkg -i \
|
|||||||
debs/{{ deb }}{{' '}}
|
debs/{{ deb }}{{' '}}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
RUN pip install ansible==2.8.12
|
|
||||||
|
|
||||||
RUN pip install pysubnettree
|
|
||||||
|
|
||||||
# Install pytest-ansible module with 'become', 'become_user' parameters support
|
|
||||||
RUN git clone https://github.com/ansible/pytest-ansible.git \
|
|
||||||
&& cd pytest-ansible \
|
|
||||||
&& git checkout d33c025f070a9c870220a157cc5a999fda68de44 \
|
|
||||||
&& python setup.py install \
|
|
||||||
&& cd .. \
|
|
||||||
&& rm -fr pytest-ansible
|
|
||||||
|
|
||||||
RUN mkdir /var/run/sshd
|
RUN mkdir /var/run/sshd
|
||||||
EXPOSE 22
|
EXPOSE 22
|
||||||
|
|
||||||
@ -188,10 +175,6 @@ RUN env-201811/bin/pip install cryptography==3.3.2 ansible==2.0.0.2
|
|||||||
|
|
||||||
RUN python3 -m venv env-python3
|
RUN python3 -m venv env-python3
|
||||||
|
|
||||||
# NOTE: There is an ordering dependency for pycryptodome. Leaving this at
|
|
||||||
# the end until we figure that out.
|
|
||||||
RUN pip install pycryptodome==3.9.8
|
|
||||||
|
|
||||||
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
|
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
|
||||||
ENV VIRTUAL_ENV=env-python3
|
ENV VIRTUAL_ENV=env-python3
|
||||||
ARG BACKUP_OF_PATH="$PATH"
|
ARG BACKUP_OF_PATH="$PATH"
|
||||||
@ -199,65 +182,66 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|||||||
|
|
||||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8
|
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8
|
||||||
|
|
||||||
RUN python3 -m pip install --upgrade --ignore-installed pip setuptools==58.4.0 wheel==0.33.6
|
RUN python3 -m pip install --upgrade pip setuptools wheel
|
||||||
RUN python3 -m pip install setuptools-rust \
|
RUN python3 -m pip install aiohttp \
|
||||||
aiohttp \
|
allure-pytest==2.8.22 \
|
||||||
defusedxml \
|
ansible==2.9.27 \
|
||||||
azure-kusto-ingest \
|
azure-storage-blob==12.9.0 \
|
||||||
azure-kusto-data \
|
azure-kusto-data \
|
||||||
cffi \
|
azure-kusto-ingest \
|
||||||
contextlib2==0.6.0.post1 \
|
defusedxml \
|
||||||
cryptography==3.3.2 \
|
celery[redis]==4.4.7 \
|
||||||
"future>=0.16.0" \
|
cffi \
|
||||||
gitpython \
|
contextlib2==0.6.0.post1 \
|
||||||
ipaddr \
|
cryptography==3.3.2 \
|
||||||
ipython==5.4.1 \
|
dpkt \
|
||||||
ixnetwork-restpy==1.0.64 \
|
"future>=0.16.0" \
|
||||||
ixnetwork-open-traffic-generator==0.0.79 \
|
gitpython \
|
||||||
snappi[ixnetwork,convergence]==0.7.44 \
|
ipaddr \
|
||||||
markupsafe==2.0.1 \
|
ipython==5.4.1 \
|
||||||
jinja2==2.7.2 \
|
ixnetwork-restpy==1.0.64 \
|
||||||
jsonpatch \
|
ixnetwork-open-traffic-generator==0.0.79 \
|
||||||
lxml \
|
jinja2==2.7.2 \
|
||||||
natsort \
|
jsonpatch \
|
||||||
netaddr \
|
lxml \
|
||||||
netmiko==2.4.2 \
|
markupsafe==2.0.1 \
|
||||||
paramiko==2.7.1 \
|
msrest==0.6.21 \
|
||||||
passlib \
|
natsort \
|
||||||
pexpect \
|
ncclient \
|
||||||
prettytable \
|
netaddr \
|
||||||
psutil \
|
netmiko==2.4.2 \
|
||||||
pyasn1==0.4.8 \
|
nnpy \
|
||||||
pyfiglet \
|
paramiko==2.7.1 \
|
||||||
pylint==1.8.1 \
|
passlib \
|
||||||
pyro4 \
|
pexpect \
|
||||||
pysnmp==4.4.12 \
|
prettytable \
|
||||||
pytest-repeat \
|
psutil \
|
||||||
pytest-html \
|
ptf \
|
||||||
pytest-xdist==1.28.0 \
|
pyasn1==0.4.8 \
|
||||||
pytest \
|
pycryptodome==3.9.8 \
|
||||||
redis \
|
pyfiglet \
|
||||||
requests \
|
pylint==1.8.1 \
|
||||||
rpyc \
|
pyro4 \
|
||||||
six \
|
pysnmp==4.4.12 \
|
||||||
tabulate \
|
pysubnettree \
|
||||||
textfsm==1.1.2 \
|
pytest-ansible \
|
||||||
virtualenv \
|
pytest-html \
|
||||||
pysubnettree \
|
pytest-repeat \
|
||||||
nnpy \
|
pytest-xdist==1.28.0 \
|
||||||
dpkt \
|
python-dateutil \
|
||||||
pycryptodome==3.9.8 \
|
pytest==7.1.3 \
|
||||||
ansible==2.8.12 \
|
redis \
|
||||||
pytest-ansible \
|
requests \
|
||||||
allure-pytest==2.8.22 \
|
retry \
|
||||||
retry \
|
rpyc \
|
||||||
thrift==0.11.0 \
|
scapy==2.4.5 \
|
||||||
ptf \
|
setuptools-rust \
|
||||||
scapy==2.4.5 \
|
six \
|
||||||
celery[redis]==4.4.7 \
|
snappi[ixnetwork,convergence]==0.7.44 \
|
||||||
msrest==0.6.21 \
|
tabulate \
|
||||||
python-dateutil \
|
textfsm==1.1.2 \
|
||||||
azure-storage-blob==12.9.0
|
thrift==0.11.0 \
|
||||||
|
virtualenv
|
||||||
|
|
||||||
# Deactivating a virtualenv
|
# Deactivating a virtualenv
|
||||||
ENV PATH="$BACKUP_OF_PATH"
|
ENV PATH="$BACKUP_OF_PATH"
|
||||||
|
Reference in New Issue
Block a user