2022-03-14 05:09:20 -05:00
|
|
|
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
|
2022-09-26 20:15:48 -05:00
|
|
|
FROM {{ prefix }}ubuntu:20.04
|
2017-05-18 18:54:48 -05:00
|
|
|
|
2023-11-02 20:04:01 -05:00
|
|
|
{% set legacy = LEGACY_SONIC_MGMT_DOCKER %}
|
|
|
|
|
2017-05-18 18:54:48 -05:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2023-03-20 19:09:44 -05:00
|
|
|
RUN apt-get update && apt-get install -y apt-transport-https \
|
|
|
|
apt-utils \
|
|
|
|
build-essential \
|
|
|
|
ca-certificates \
|
2020-06-16 13:32:25 -05:00
|
|
|
cmake \
|
|
|
|
curl \
|
|
|
|
default-jre \
|
|
|
|
git \
|
2023-06-25 03:51:58 -05:00
|
|
|
gnupg \
|
|
|
|
gnupg-agent \
|
2020-09-22 20:39:14 -05:00
|
|
|
iproute2 \
|
2023-03-20 19:09:44 -05:00
|
|
|
iputils-ping \
|
2020-09-23 22:01:58 -05:00
|
|
|
isc-dhcp-client \
|
2020-06-16 13:32:25 -05:00
|
|
|
libffi-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libxml2 \
|
|
|
|
libxslt1-dev \
|
2023-03-20 19:09:44 -05:00
|
|
|
lsb-release \
|
|
|
|
jq \
|
2020-06-16 13:32:25 -05:00
|
|
|
openssh-server \
|
|
|
|
psmisc \
|
|
|
|
python \
|
|
|
|
python-dev \
|
2020-09-18 00:00:32 -05:00
|
|
|
python3-pip \
|
|
|
|
python3-venv \
|
2020-06-16 13:32:25 -05:00
|
|
|
rsyslog \
|
2023-03-03 13:24:26 -06:00
|
|
|
shellcheck \
|
2020-06-16 13:32:25 -05:00
|
|
|
snmp \
|
2022-10-17 21:02:30 -05:00
|
|
|
software-properties-common \
|
2020-06-16 13:32:25 -05:00
|
|
|
sshpass \
|
|
|
|
sudo \
|
|
|
|
tcpdump \
|
|
|
|
telnet \
|
2022-10-17 21:02:30 -05:00
|
|
|
vim
|
2022-09-26 20:15:48 -05:00
|
|
|
|
2023-10-30 20:44:55 -05:00
|
|
|
RUN python3 -m pip install --upgrade pip setuptools wheel
|
|
|
|
RUN python3 -m pip install aiohttp \
|
2023-09-13 03:20:17 -05:00
|
|
|
allure-pytest==2.8.22 \
|
2023-10-30 20:44:55 -05:00
|
|
|
ansible==6.7.0 \
|
2023-09-13 03:20:17 -05:00
|
|
|
azure-storage-blob==12.9.0 \
|
|
|
|
azure-kusto-data \
|
|
|
|
azure-kusto-ingest \
|
|
|
|
defusedxml \
|
|
|
|
celery[redis]==5.2.7 \
|
|
|
|
cffi \
|
|
|
|
contextlib2==0.6.0.post1 \
|
2023-10-30 20:44:55 -05:00
|
|
|
cryptography==41.0.2 \
|
2023-09-27 20:13:44 -05:00
|
|
|
ctypesgen \
|
2023-09-13 03:20:17 -05:00
|
|
|
dpkt \
|
2023-09-27 20:13:44 -05:00
|
|
|
dpugen==0.1.1 \
|
2023-09-13 03:20:17 -05:00
|
|
|
"future>=0.16.0" \
|
|
|
|
gitpython \
|
|
|
|
ipaddr \
|
|
|
|
ipython==8.12.2 \
|
2023-09-27 20:13:44 -05:00
|
|
|
ixload \
|
2023-09-13 03:20:17 -05:00
|
|
|
ixnetwork-restpy==1.0.64 \
|
|
|
|
ixnetwork-open-traffic-generator==0.0.79 \
|
2023-10-30 20:44:55 -05:00
|
|
|
jinja2==3.1.2 \
|
2023-09-13 03:20:17 -05:00
|
|
|
jsonpatch \
|
|
|
|
lxml \
|
|
|
|
markupsafe==2.0.1 \
|
|
|
|
mock \
|
|
|
|
msrest==0.6.21 \
|
|
|
|
natsort \
|
|
|
|
ncclient \
|
|
|
|
netaddr \
|
|
|
|
netmiko==2.4.2 \
|
2023-09-27 20:13:44 -05:00
|
|
|
pandas \
|
2023-10-25 00:51:16 -05:00
|
|
|
paramiko==2.9.5 \
|
2023-09-13 03:20:17 -05:00
|
|
|
passlib \
|
|
|
|
pexpect \
|
|
|
|
prettytable \
|
|
|
|
psutil \
|
|
|
|
ptf \
|
|
|
|
pyasn1==0.4.8 \
|
|
|
|
pycryptodome==3.9.8 \
|
|
|
|
pyfiglet \
|
|
|
|
pylint==1.8.1 \
|
|
|
|
pyro4 \
|
|
|
|
pysnmp==4.4.12 \
|
|
|
|
pysubnettree \
|
2023-10-30 20:44:55 -05:00
|
|
|
pytest-ansible==4.0.0 \
|
2023-09-13 03:20:17 -05:00
|
|
|
pytest-html \
|
|
|
|
pytest-repeat \
|
|
|
|
pytest-xdist==1.28.0 \
|
|
|
|
python-dateutil \
|
2023-10-30 20:44:55 -05:00
|
|
|
pytest==7.4.0 \
|
2023-09-27 20:13:44 -05:00
|
|
|
PyYAML \
|
2023-09-13 03:20:17 -05:00
|
|
|
redis \
|
|
|
|
requests \
|
|
|
|
retry \
|
|
|
|
rpyc \
|
|
|
|
scandir \
|
2024-01-19 11:11:52 -06:00
|
|
|
scapy==2.5.0 \
|
2023-09-13 03:20:17 -05:00
|
|
|
setuptools-rust \
|
|
|
|
six \
|
2024-01-04 11:05:42 -06:00
|
|
|
snappi==0.9.1 \
|
|
|
|
snappi-convergence==0.4.1 \
|
|
|
|
snappi-ixnetwork==0.9.1 \
|
2023-09-13 03:20:17 -05:00
|
|
|
tabulate \
|
|
|
|
textfsm==1.1.2 \
|
|
|
|
thrift==0.11.0 \
|
|
|
|
virtualenv \
|
2023-07-10 20:54:10 -05:00
|
|
|
&& 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 \
|
2023-09-13 03:20:17 -05:00
|
|
|
&& rm -f 1.2.tar.gz \
|
2023-10-30 20:44:55 -05:00
|
|
|
&& python3 -m pip install nnpy
|
2022-10-17 21:02:30 -05:00
|
|
|
|
2023-11-02 20:04:01 -05:00
|
|
|
{% if legacy == 'y' or legacy == '1' %}
|
2022-10-17 21:02:30 -05:00
|
|
|
RUN curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \
|
|
|
|
&& python2 get-pip.py \
|
2023-10-30 20:44:55 -05:00
|
|
|
&& rm -f get-pip.py
|
2017-06-26 23:28:51 -05:00
|
|
|
|
2023-10-30 20:44:55 -05:00
|
|
|
RUN python2 -m pip install --upgrade pip setuptools wheel
|
|
|
|
RUN python2 -m pip install allure-pytest==2.8.22 \
|
|
|
|
ansible==2.8.20 \
|
2023-09-13 03:20:17 -05:00
|
|
|
azure-storage-blob==12.9.0 \
|
|
|
|
celery[redis]==4.4.7 \
|
|
|
|
cffi==1.12.0 \
|
|
|
|
contextlib2==0.6.0.post1 \
|
|
|
|
cryptography==3.3.2 \
|
2023-09-27 20:13:44 -05:00
|
|
|
ctypesgen \
|
2023-09-13 03:20:17 -05:00
|
|
|
dpkt \
|
2023-09-27 20:13:44 -05:00
|
|
|
dpugen==0.1.1 \
|
2023-09-13 03:20:17 -05:00
|
|
|
"future>=0.16.0" \
|
|
|
|
gitpython \
|
|
|
|
ipaddr \
|
|
|
|
ipython==5.4.1 \
|
2023-09-27 20:13:44 -05:00
|
|
|
ixload \
|
2023-09-13 03:20:17 -05:00
|
|
|
ixnetwork-restpy==1.0.64 \
|
|
|
|
ixnetwork-open-traffic-generator==0.0.79 \
|
|
|
|
jinja2==2.10.1 \
|
|
|
|
jsonpatch \
|
|
|
|
lazy-object-proxy==1.6.0 \
|
|
|
|
lxml \
|
|
|
|
mock \
|
|
|
|
msrest==0.6.21 \
|
|
|
|
natsort \
|
2024-02-13 22:40:25 -06:00
|
|
|
netaddr==0.10.1 \
|
2023-09-13 03:20:17 -05:00
|
|
|
netmiko==2.4.2 \
|
|
|
|
nnpy \
|
2023-09-27 20:13:44 -05:00
|
|
|
pandas \
|
2023-10-30 20:44:55 -05:00
|
|
|
paramiko==2.7.2 \
|
2023-09-13 03:20:17 -05:00
|
|
|
passlib \
|
|
|
|
pexpect \
|
|
|
|
prettytable \
|
2023-10-30 20:44:55 -05:00
|
|
|
protobuf==3.15.0 \
|
2023-09-13 03:20:17 -05:00
|
|
|
psutil \
|
2023-10-30 20:44:55 -05:00
|
|
|
ptf \
|
2023-09-13 03:20:17 -05:00
|
|
|
pyaml==21.10.1 \
|
|
|
|
pyasn1==0.1.9 \
|
|
|
|
pycryptodome==3.9.8 \
|
|
|
|
pyfiglet \
|
|
|
|
pylint==1.8.1 \
|
|
|
|
pyro4 \
|
|
|
|
pysnmp==4.2.5 \
|
|
|
|
pysubnettree \
|
|
|
|
pytest==4.6.11 \
|
|
|
|
pytest-ansible \
|
|
|
|
pytest-repeat \
|
|
|
|
pytest-html \
|
|
|
|
pytest-xdist==1.28.0 \
|
|
|
|
python-dateutil \
|
2023-09-27 20:13:44 -05:00
|
|
|
PyYAML \
|
2023-09-13 03:20:17 -05:00
|
|
|
redis \
|
|
|
|
requests \
|
|
|
|
retry \
|
|
|
|
rpyc \
|
|
|
|
scandir \
|
2024-01-19 11:11:52 -06:00
|
|
|
scapy==2.5.0 \
|
2023-09-13 03:20:17 -05:00
|
|
|
six \
|
2024-01-04 11:05:42 -06:00
|
|
|
snappi==0.9.1 \
|
|
|
|
snappi-convergence==0.4.1 \
|
|
|
|
snappi-ixnetwork==0.9.1 \
|
2023-09-13 03:20:17 -05:00
|
|
|
statistics \
|
|
|
|
tabulate \
|
|
|
|
textfsm==1.1.3 \
|
|
|
|
thrift==0.11.0 \
|
2023-10-30 20:44:55 -05:00
|
|
|
virtualenv
|
2023-11-02 20:04:01 -05:00
|
|
|
{% endif %}
|
2017-05-18 18:54:48 -05:00
|
|
|
|
2019-12-10 20:03:55 -06:00
|
|
|
# Install docker-ce-cli
|
2023-06-25 03:51:58 -05:00
|
|
|
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
|
2019-12-10 20:03:55 -06:00
|
|
|
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y docker-ce-cli
|
|
|
|
|
2023-06-25 03:51:58 -05:00
|
|
|
# Install Azure CLI, following https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-2-step-by-step-installation-instructions
|
|
|
|
RUN mkdir -p /etc/apt/keyrings \
|
|
|
|
&& curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/keyrings/microsoft.gpg > /dev/null \
|
|
|
|
&& chmod go+r /etc/apt/keyrings/microsoft.gpg \
|
|
|
|
&& echo "deb [arch=`dpkg --print-architecture` signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ `lsb_release -cs` main" | tee /etc/apt/sources.list.d/azure-cli.list \
|
|
|
|
&& apt-get update && apt-get install -y azure-cli
|
|
|
|
|
2017-07-19 10:10:45 -05:00
|
|
|
## Copy and install sonic-mgmt docker dependencies
|
2023-10-30 20:44:55 -05:00
|
|
|
COPY debs/sonic-device-data_*.deb debs/
|
2017-07-19 10:10:45 -05:00
|
|
|
|
2023-10-30 20:44:55 -05:00
|
|
|
RUN dpkg -i debs/sonic-device-data_*.deb
|
2017-07-19 10:10:45 -05:00
|
|
|
|
2023-09-23 02:25:43 -05:00
|
|
|
# Install protobuf 3.21.12 which is from https://deb.debian.org/debian/pool/main/p/protobuf/protobuf_3.21.12-3.dsc
|
2023-07-14 13:23:25 -05:00
|
|
|
RUN mkdir -p /tmp/protobuf \
|
2023-08-08 23:04:54 -05:00
|
|
|
&& cd /tmp/protobuf \
|
2023-07-14 13:23:25 -05:00
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-dev_3.21.12-3_amd64.deb \
|
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf-lite32_3.21.12-3_amd64.deb \
|
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotobuf32_3.21.12-3_amd64.deb \
|
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotoc-dev_3.21.12-3_amd64.deb \
|
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/libprotoc32_3.21.12-3_amd64.deb \
|
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/protobuf-compiler_3.21.12-3_amd64.deb \
|
|
|
|
&& wget https://sonicstorage.blob.core.windows.net/public/ubuntu/20.04/python3-protobuf_3.21.12-3_amd64.deb \
|
|
|
|
&& dpkg -i *.deb \
|
|
|
|
&& rm -rf /tmp/protobuf
|
|
|
|
|
|
|
|
# Install dash-api
|
|
|
|
RUN cd /tmp \
|
|
|
|
&& mkdir -p /usr/lib/python3/dist-packages/dash_api \
|
2023-12-14 00:49:04 -06:00
|
|
|
&& wget https://raw.githubusercontent.com/sonic-net/sonic-dash-api/master/misc/pypkg/dash_api/__init__.py -O /usr/lib/python3/dist-packages/dash_api/__init__.py \
|
2023-07-14 13:23:25 -05:00
|
|
|
&& git clone https://github.com/sonic-net/sonic-dash-api.git \
|
|
|
|
&& protoc -I=sonic-dash-api/proto --python_out=/usr/lib/python3/dist-packages/dash_api sonic-dash-api/proto/*.proto \
|
|
|
|
&& rm -rf /tmp/sonic-dash-api
|
|
|
|
|
2017-05-18 18:54:48 -05:00
|
|
|
RUN mkdir /var/run/sshd
|
|
|
|
EXPOSE 22
|
|
|
|
|
|
|
|
# Add user
|
|
|
|
ARG user
|
|
|
|
ARG uid
|
|
|
|
ARG guid
|
|
|
|
ARG hostname
|
|
|
|
|
|
|
|
ENV BUILD_HOSTNAME $hostname
|
|
|
|
ENV USER $user
|
2020-04-12 15:35:28 -05:00
|
|
|
ENV CC=gcc CPP=cpp CXX=c++ LDSHARED="gcc -pthread -shared" PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1
|
2017-05-18 18:54:48 -05:00
|
|
|
|
|
|
|
RUN groupadd -f -r -g $guid g$user
|
|
|
|
|
|
|
|
RUN useradd $user -l -u $uid -g $guid -d /var/$user -m -s /bin/bash
|
|
|
|
|
|
|
|
COPY sonic-jenkins.pub /var/$user/.ssh/authorized_keys2
|
|
|
|
|
|
|
|
RUN echo "Host *\n\tStrictHostKeyChecking no\n" > /var/$user/.ssh/config
|
|
|
|
RUN chown $user /var/$user/.ssh -R
|
|
|
|
RUN chmod go= /var/$user/.ssh -R
|
|
|
|
|
|
|
|
# Add user to sudoers
|
|
|
|
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers
|
|
|
|
|
|
|
|
USER $user
|
2018-01-18 17:35:38 -06:00
|
|
|
WORKDIR /var/$user
|
2020-09-22 11:37:03 -05:00
|
|
|
|
|
|
|
# Add az symlink for backwards compatibility
|
|
|
|
RUN mkdir bin && ln -s /usr/bin/az bin/az
|
2018-04-24 02:14:19 -05:00
|
|
|
|
2023-03-20 19:09:44 -05:00
|
|
|
USER root
|
|
|
|
WORKDIR /azp
|
2023-10-30 20:44:55 -05:00
|
|
|
COPY start.sh \
|
|
|
|
0001-Fix-getattr-AttributeError-in-multi-thread-scenario.patch \
|
2023-11-29 19:23:25 -06:00
|
|
|
./
|
2023-10-30 20:44:55 -05:00
|
|
|
RUN chmod +x start.sh \
|
|
|
|
&& ln -sf /usr/bin/python3 /usr/bin/python \
|
|
|
|
&& ln -sf `which pip3` /usr/bin/pip \
|
|
|
|
&& ln -sf `which pip3` /usr/local/sbin/pip \
|
|
|
|
&& patch -u -b /usr/local/lib/python3.8/dist-packages/ansible/plugins/loader.py -i /azp/0001-Fix-getattr-AttributeError-in-multi-thread-scenario.patch
|
2023-03-20 19:09:44 -05:00
|
|
|
|
|
|
|
USER $user
|
|
|
|
WORKDIR /var/$user
|