-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
97 lines (92 loc) · 4.37 KB
/
Dockerfile
File metadata and controls
97 lines (92 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
FROM ubuntu:24.04
ARG TARFILE=latest
# 1. Ubuntu 24.04 has python 3.12 standard. Unfortunately, trex, as of
# the current version 3.06, does not work with python 3.12, but
# "should" work with python 3.11.
# Therefore, we install python 3.11 (in parallel with the system 3.12)
# and set up a venv with it (and use pip in the venv to install the
# python modules needed for trex). Trex must be started in this 3.11 venv.
#
# The "deadsnakes" ppa has python 3.11
#
# 2. When trex (_t-rex-64) start in the container, it emits an error:
#
# ./_t-rex-64: so/x86_64/libstdc++.so.6: version `GLIBCXX_3.4.30'
# not found (required by /lib/x86_64-linux-gnu/libicuuc.so.74)
#
# presumably because it is trying to use the system libicuuc and
# its own bundled libstdc++.so.6
#
# Try to work around this problem by copying the system libstdc++.so.6
# (which DOES support GLIBCXX_3.4.30) into trex's so/x86_64 directory.
RUN apt-get update -qy && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
bash bash-completion libarchive-tools bzip2 cpio curl ethtool gettext gettext \
git git iproute2 iputils-ping jq libedit-dev libffi-dev libgmp-dev \
libncurses5-dev libpython3-dev libssl-dev libssl-dev libtool \
linux-headers-generic locales lsof make net-tools netcat-openbsd \
patch pciutils perl-modules \
python3 python3-dev python3-pip python3-venv sudo tidy util-linux \
wget xsltproc xutils-dev zlib1g-dev \
&& \
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen && \
locale-gen && \
echo examining libstdc++.so.6 ;\
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX &&\
echo Starting python 3.11 install ;\
DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common &&\
add-apt-repository ppa:deadsnakes/ppa &&\
apt update -qy &&\
DEBIAN_FRONTEND=noninteractive apt install -y python3.11 python3.11-venv &&\
echo initializing venv... &&\
python3.11 -m venv /usr/local/venv-python3.11 &&\
echo activating... &&\
. /usr/local/venv-python3.11/bin/activate &&\
echo running pip... &&\
pip install coverage cryptography lxml nose pylint pytest \
tox twine wheel dpkt jsonrpclib-pelix repoze.lru \
scapy simpy texttable pyyaml zmq \
pyzmq-ctypes simple_enum
COPY wait-for*.sh /usr/bin/
WORKDIR /trex
COPY ${TARFILE} .
RUN tar -xzf ${TARFILE} --strip-components=1 && rm ${TARFILE}
RUN mv -f so/x86_64/libstdc++.so.6 so/x86_64/OLD-libstdc++.so.6.OLD &&\
cp -p /usr/lib/x86_64-linux-gnu/libstdc++.so.6 so/x86_64/
RUN tar -xf trex_client*.tar.gz && \
# silly expectation of trex
cp -pr trex_client/external_libs /usr/local && \
_cistl=trex_client/interactive/trex_stl_lib &&\
_csstl=trex_client/stl/trex_stl_lib &&\
_csstf=trex_client/stf/trex_stf_lib &&\
_cessl=trex_client/external_libs/trex-openssl &&\
# Python3.6
mkdir -p /usr/local/lib/python3.6/dist-packages &&\
(cp -pr ${_cistl} /usr/local/lib/python3.6/dist-packages || \
cp -pr ${_csstl} /usr/local/lib/python3.6/dist-packages) && \
cp -pr ${_csstf} /usr/local/lib/python3.6/dist-packages && \
cp -pr ${_cessl} /usr/local/lib/python3.6/dist-packages && \
# Python3.7
mkdir -p /usr/local/lib/python3.7/dist-packages && \
(cp -pr ${_cistl} /usr/local/lib/python3.7/dist-packages || \
cp -pr ${_csstl} /usr/local/lib/python3.7/dist-packages) && \
cp -pr ${_csstf} /usr/local/lib/python3.7/dist-packages && \
cp -pr ${_cessl} /usr/local/lib/python3.7/dist-packages && \
# Cleanup image
rm trex_client*.tar.gz && \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
EXPOSE 4500 4501 8090
# echo Starting apt-get for formerly-pip3 ;\
# DEBIAN_FRONTEND=noninteractive apt-get install -y \
# python3-coverage python3-cryptography python3-lxml \
# python3-nose python3-pylint-common python3-pytest-pylint \
# tox twine python3-wheel python3-dpkt python3-jsonrpclib-pelix \
# python3-repoze.lru python3-scapy python3-simpy python3-texttable \
# python3-pytest python3-yaml python3-zmq \
# && \
# echo skipping: python3 -m pip install -U ryu pyzmq-ctypes simple_enum && \
# echo skipping: python2 -m pip install -U coverage cryptography lxml nose pylint \
# pytest pyyaml ryu tox twine wheel \
# dpkt jsonrpclib-pelix pyyaml pyzmq-ctypes repoze.lru scapy simple_enum simpy texttable