02e0aff5e7
* [ci] Set default ACR in UpgrateVersion/PR/official pipeline. (#10341) Why I did it docker hub will limit the pull rate. Use ACR instead to pull debian related docker image. How I did it Set DEFAULT_CONTAINER_REGISTRY in pipeline. * Add a config variable to override default container registry instead of dockerhub. (#10166) * Add variable to reset default docker registry * fix bug in docker version control
146 lines
4.5 KiB
Django/Jinja
146 lines
4.5 KiB
Django/Jinja
{% set prefix = DEFAULT_CONTAINER_REGISTRY %}
|
|
{% if CONFIGURED_ARCH == "armhf" %}
|
|
FROM {{ prefix }}multiarch/debian-debootstrap:armhf-stretch
|
|
{% elif CONFIGURED_ARCH == "arm64" %}
|
|
FROM {{ prefix }}multiarch/debian-debootstrap:arm64-stretch
|
|
{% else %}
|
|
FROM {{ prefix }}debian:stretch
|
|
{% endif %}
|
|
|
|
MAINTAINER Pavel Shirshov
|
|
|
|
## Remove retired jessie-updates repo
|
|
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
|
|
|
|
## Copy dependencies
|
|
COPY \
|
|
{% for deb in docker_ptf_debs.split(' ') -%}
|
|
debs/{{ deb }}{{' '}}
|
|
{%- endfor -%}
|
|
debs/
|
|
|
|
## Make apt-get non-interactive
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
## Set the apt source, update package cache and install necessary packages
|
|
## TODO: Clean up this step
|
|
RUN sed --in-place 's/httpredir.debian.org/debian-archive.trafficmanager.net/' /etc/apt/sources.list \
|
|
&& apt-get update \
|
|
&& apt-get upgrade -y \
|
|
&& apt-get dist-upgrade -y \
|
|
&& apt-get install -y \
|
|
openssh-server \
|
|
vim \
|
|
telnet \
|
|
net-tools \
|
|
traceroute \
|
|
lsof \
|
|
tcpdump \
|
|
ethtool \
|
|
unzip \
|
|
pkg-config \
|
|
binutils \
|
|
build-essential \
|
|
libssl-dev \
|
|
libffi-dev \
|
|
wget \
|
|
cmake \
|
|
libqt5core5a \
|
|
libqt5network5 \
|
|
libboost-atomic1.62.0 \
|
|
less \
|
|
git \
|
|
iputils-ping \
|
|
hping3 \
|
|
curl \
|
|
tmux \
|
|
python \
|
|
python-dev \
|
|
python-libpcap \
|
|
python-scapy \
|
|
python-six \
|
|
tacacs+ \
|
|
rsyslog \
|
|
ntp \
|
|
ntpstat \
|
|
ntpdate \
|
|
arping \
|
|
bridge-utils \
|
|
libteam-utils
|
|
|
|
|
|
RUN dpkg -i \
|
|
{% for deb in docker_ptf_debs.split(' ') -%}
|
|
debs/{{ deb }}{{' '}}
|
|
{%- endfor %}
|
|
|
|
# Install all python modules from pypi. python-scapy is exception, ptf debian package requires python-scapy
|
|
# TODO: Clean up this step
|
|
RUN rm -rf /debs \
|
|
&& apt-get -y autoclean \
|
|
&& apt-get -y autoremove \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& wget --https-only https://bootstrap.pypa.io/pip/2.7/get-pip.py \
|
|
&& python get-pip.py \
|
|
&& rm -f get-pip.py \
|
|
&& pip install setuptools \
|
|
&& pip install supervisor \
|
|
&& pip install ipython==5.4.1 \
|
|
&& 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 \
|
|
&& pip install cffi \
|
|
&& pip install nnpy \
|
|
&& pip install dpkt \
|
|
&& pip install ipaddress \
|
|
&& pip install pysubnettree \
|
|
&& pip install paramiko \
|
|
&& pip install flask \
|
|
&& pip install exabgp==3.4.17\
|
|
&& pip install pyaml \
|
|
&& pip install pybrctl pyro4 rpyc yabgp \
|
|
&& mkdir -p /opt \
|
|
&& cd /opt \
|
|
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py
|
|
|
|
## Adjust sshd settings
|
|
RUN mkdir /var/run/sshd \
|
|
&& echo 'root:root' | chpasswd \
|
|
&& sed -ri '/^#?PermitRootLogin/c\PermitRootLogin yes' /etc/ssh/sshd_config \
|
|
&& sed -ri '/^#?UsePAM/c\UsePAM no' /etc/ssh/sshd_config \
|
|
&& sed -ri '/^#?UseDNS/c\UseDNS no' /etc/ssh/sshd_config
|
|
|
|
COPY supervisord.conf /etc/supervisor/
|
|
COPY conf.d/ /etc/supervisor/conf.d/
|
|
COPY ptf_tgen.sh /ptf_tgen/
|
|
|
|
# Move tcpdump into /usr/bin Otherwise it's impossible to run tcpdump due to a docker bug
|
|
RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
|
|
RUN ln -s /usr/bin/tcpdump /usr/sbin/tcpdump
|
|
|
|
RUN mkdir -p /var/log/supervisor
|
|
|
|
# Install Python-based GNMI client
|
|
RUN git clone https://github.com/lguohan/gnxi.git \
|
|
&& cd gnxi \
|
|
&& git checkout d01b36e \
|
|
&& cd gnmi_cli_py \
|
|
&& pip install -r requirements.txt
|
|
|
|
EXPOSE 22 8009
|
|
|
|
ENTRYPOINT ["/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|