sonic-buildimage/dockers/docker-ptf-sai/Dockerfile.j2
Saikrishna Arcot fb618b6e0b
[202305] Backport PRs to fix build (#16896, #16859, #16636) (#16934)
* Remove main deb installation for derived deb build (#16859)

* Don't install dependencies of derived debs

When "building" a derived deb package, don't install the dependencies of
the package into the container. It's not needed at this stage.

* Re-add openssh-client and openssh-sftp-server as derived debs

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

---------

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
(cherry picked from commit 9ae77bc2dd)

* Re-add missing dependency for derived debs. (#16896)

* Re-add missing dependency for derived debs.

My previous changed removed the whole dependency on the main deb
existing, not just the installation of the main deb. Fix this by
readding a dependency on the main deb being built/pulled from cache.

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>

---------

Signed-off-by: Saikrishna Arcot <sarcot@microsoft.com>
(cherry picked from commit 963d40a77b)

* [build] Fix build issue in docker-ptf-sai caused by setuptools_scm new release (#16636)

docker-ptf-sai build fails on setuptools_scm's new release on 09/20/2023.
Use old version instead.

(cherry picked from commit bfa05c8349)

---------

Co-authored-by: Liu Shilong <shilongliu@microsoft.com>
2023-10-20 15:39:54 +08:00

50 lines
1.5 KiB
Django/Jinja

{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-ptf-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
# Set the apt source, update package cache and install necessary packages
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get dist-upgrade -y \
&& apt-get install -y \
python3-pip
RUN pip3 install crc16 \
netifaces \
getmac \
packet_helper \
psutil \
scapy_helper \
pysubnettree \
importlib-metadata \
xmlrunner
# 8.0.1 breaks build on 09/20/2023
RUN pip3 install setuptools_scm==7.1.0
COPY \
{% for deb in docker_ptf_sai_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor -%}
debs/
RUN dpkg -i \
{% for deb in docker_ptf_sai_debs.split(' ') -%}
debs/{{ deb }}{{' '}}
{%- endfor %}
# Remove old ptf package
RUN dpkg -r python-ptf
# Install new ptf package
RUN git clone https://github.com/p4lang/ptf.git \
&& cd ptf \
&& python3.7 setup.py install --single-version-externally-managed --record /tmp/ptf_install.txt
run echo "declare -x LANG=\"C.UTF-8\"" >> /root/.bashrc
run echo "declare -x LC_ALL=\"C.UTF-8\"" >> /root/.bashrc
run echo "declare -x PYTHONIOENCODING=\"UTF-8\"" >> /root/.bashrc
run echo "declare -x VIRTUAL_ENV=\"/root/env-python3\"" >> /root/.bashrc