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
|
|
|
|
|
|
|
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 \
|
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
|
|
|
|
2022-10-17 21:02:30 -05:00
|
|
|
RUN curl -fsSL http://archive.ubuntu.com/ubuntu/pool/universe/s/scapy/python-scapy_2.3.3-3_all.deb \
|
2022-09-26 20:15:48 -05:00
|
|
|
--output python-scapy_2.3.3-3_all.deb \
|
2022-10-17 21:02:30 -05:00
|
|
|
&& dpkg -i python-scapy_2.3.3-3_all.deb \
|
|
|
|
&& rm -f python-scapy_2.3.3-3_all.deb
|
|
|
|
|
|
|
|
RUN curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py \
|
|
|
|
&& python2 get-pip.py \
|
|
|
|
&& rm -f get-pip.py \
|
|
|
|
&& ln -sf `which pip2` /usr/bin/pip
|
2017-06-26 23:28:51 -05:00
|
|
|
|
2022-10-17 21:02:30 -05:00
|
|
|
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 \
|
2021-06-28 19:15:03 -05:00
|
|
|
contextlib2==0.6.0.post1 \
|
2021-03-10 21:15:11 -06:00
|
|
|
cryptography==3.3.2 \
|
2022-10-17 21:02:30 -05:00
|
|
|
dpkt \
|
2020-04-12 15:35:28 -05:00
|
|
|
"future>=0.16.0" \
|
|
|
|
gitpython \
|
2020-06-16 13:32:25 -05:00
|
|
|
ipaddr \
|
|
|
|
ipython==5.4.1 \
|
2021-04-23 12:17:19 -05:00
|
|
|
ixnetwork-restpy==1.0.64 \
|
2021-04-29 14:31:46 -05:00
|
|
|
ixnetwork-open-traffic-generator==0.0.79 \
|
2023-03-20 19:09:44 -05:00
|
|
|
jinja2==2.10.1 \
|
2020-04-12 15:35:28 -05:00
|
|
|
jsonpatch \
|
2022-10-17 21:02:30 -05:00
|
|
|
lazy-object-proxy==1.6.0 \
|
2020-06-16 13:32:25 -05:00
|
|
|
lxml \
|
2023-03-03 13:24:26 -06:00
|
|
|
mock \
|
2022-10-17 21:02:30 -05:00
|
|
|
msrest==0.6.21 \
|
2020-06-16 13:32:25 -05:00
|
|
|
natsort \
|
|
|
|
netaddr \
|
2020-04-12 15:35:28 -05:00
|
|
|
netmiko==2.4.2 \
|
2020-06-16 13:32:25 -05:00
|
|
|
paramiko==2.7.1 \
|
|
|
|
passlib \
|
|
|
|
pexpect \
|
2020-04-12 15:35:28 -05:00
|
|
|
prettytable \
|
|
|
|
psutil \
|
2020-06-16 13:32:25 -05:00
|
|
|
pyasn1==0.1.9 \
|
2022-10-17 21:02:30 -05:00
|
|
|
pycryptodome==3.9.8 \
|
2020-04-12 15:35:28 -05:00
|
|
|
pyfiglet \
|
|
|
|
pylint==1.8.1 \
|
|
|
|
pyro4 \
|
2020-06-16 13:32:25 -05:00
|
|
|
pysnmp==4.2.5 \
|
2022-10-17 21:02:30 -05:00
|
|
|
pysubnettree \
|
|
|
|
pytest==4.6.11 \
|
|
|
|
pytest-ansible \
|
2020-04-12 15:35:28 -05:00
|
|
|
pytest-repeat \
|
2020-06-25 19:45:16 -05:00
|
|
|
pytest-html \
|
2020-04-12 15:35:28 -05:00
|
|
|
pytest-xdist==1.28.0 \
|
2022-10-17 21:02:30 -05:00
|
|
|
python-dateutil \
|
2020-04-12 15:35:28 -05:00
|
|
|
redis \
|
|
|
|
requests \
|
2022-10-17 21:02:30 -05:00
|
|
|
retry \
|
2020-04-12 15:35:28 -05:00
|
|
|
rpyc \
|
2023-03-13 19:58:11 -05:00
|
|
|
scandir \
|
2020-06-16 13:32:25 -05:00
|
|
|
six \
|
2022-10-17 21:02:30 -05:00
|
|
|
snappi[ixnetwork,convergence]==0.7.44 \
|
2022-01-24 20:32:22 -06:00
|
|
|
statistics \
|
2022-10-17 21:02:30 -05:00
|
|
|
tabulate \
|
|
|
|
textfsm==1.1.3 \
|
2021-08-31 21:20:06 -05:00
|
|
|
thrift==0.11.0 \
|
2022-10-17 21:02:30 -05:00
|
|
|
virtualenv \
|
2019-07-30 12:19:48 -05:00
|
|
|
&& git clone https://github.com/p4lang/scapy-vxlan.git \
|
|
|
|
&& cd scapy-vxlan \
|
|
|
|
&& 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 \
|
2022-10-17 21:02:30 -05:00
|
|
|
&& pip install nnpy \
|
2022-09-26 20:15:48 -05:00
|
|
|
&& pip install scapy==2.4.5 --upgrade --ignore-installed
|
2017-05-18 18:54:48 -05:00
|
|
|
|
2019-12-10 20:03:55 -06:00
|
|
|
# Install docker-ce-cli
|
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y \
|
|
|
|
apt-transport-https \
|
|
|
|
ca-certificates \
|
|
|
|
gnupg-agent \
|
|
|
|
&& 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" \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y docker-ce-cli
|
|
|
|
|
2020-09-22 11:37:03 -05:00
|
|
|
# Install Azure CLI
|
|
|
|
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
|
|
|
|
2017-07-19 10:10:45 -05:00
|
|
|
## Copy and install sonic-mgmt docker dependencies
|
|
|
|
COPY \
|
|
|
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
|
|
|
debs/{{ deb }}{{' '}}
|
|
|
|
{%- endfor -%}
|
|
|
|
debs/
|
|
|
|
|
2022-09-09 09:18:13 -05:00
|
|
|
RUN dpkg -i \
|
2017-07-19 10:10:45 -05:00
|
|
|
{% for deb in docker_sonic_mgmt_debs.split(' ') -%}
|
|
|
|
debs/{{ deb }}{{' '}}
|
|
|
|
{%- endfor %}
|
|
|
|
|
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
|
|
|
|
2020-09-18 00:00:32 -05:00
|
|
|
RUN python3 -m venv env-python3
|
|
|
|
|
2022-03-08 22:28:01 -06:00
|
|
|
# Activating a virtualenv. The virtualenv automatically works for RUN, ENV and CMD.
|
|
|
|
ENV VIRTUAL_ENV=env-python3
|
|
|
|
ARG BACKUP_OF_PATH="$PATH"
|
|
|
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
|
|
|
|
|
|
|
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=UTF-8
|
|
|
|
|
2022-10-17 21:02:30 -05:00
|
|
|
RUN python3 -m pip install --upgrade pip setuptools wheel
|
|
|
|
RUN python3 -m pip 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 \
|
2023-03-20 19:09:44 -05:00
|
|
|
jinja2==2.10.1 \
|
2022-10-17 21:02:30 -05:00
|
|
|
jsonpatch \
|
|
|
|
lxml \
|
|
|
|
markupsafe==2.0.1 \
|
2023-03-03 13:24:26 -06:00
|
|
|
mock \
|
2022-10-17 21:02:30 -05:00
|
|
|
msrest==0.6.21 \
|
|
|
|
natsort \
|
|
|
|
ncclient \
|
|
|
|
netaddr \
|
|
|
|
netmiko==2.4.2 \
|
|
|
|
nnpy \
|
|
|
|
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 \
|
2023-03-13 19:58:11 -05:00
|
|
|
scandir \
|
2022-10-17 21:02:30 -05:00
|
|
|
scapy==2.4.5 \
|
|
|
|
setuptools-rust \
|
|
|
|
six \
|
|
|
|
snappi[ixnetwork,convergence]==0.7.44 \
|
|
|
|
tabulate \
|
|
|
|
textfsm==1.1.2 \
|
|
|
|
thrift==0.11.0 \
|
|
|
|
virtualenv
|
2022-03-08 22:28:01 -06:00
|
|
|
|
2022-09-26 20:15:48 -05:00
|
|
|
# Deactivating a virtualenv
|
2022-03-08 22:28:01 -06:00
|
|
|
ENV PATH="$BACKUP_OF_PATH"
|
2023-03-20 19:09:44 -05:00
|
|
|
|
|
|
|
USER root
|
|
|
|
WORKDIR /azp
|
|
|
|
COPY ./start.sh .
|
|
|
|
RUN chmod +x start.sh
|
|
|
|
|
|
|
|
USER $user
|
|
|
|
WORKDIR /var/$user
|