blob: 2c438937be4b92db6fac2fd2a669bfc4dd5a3550 [file] [log] [blame]
Yi Tsengaae6ef52021-09-01 13:48:27 -07001# SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation.
2# SPDX-License-Identifier: Apache-2.0
Daniele Moroe734b7f2021-09-07 17:53:20 +02003ARG SCAPY_VER=2.4.5
4ARG TREX_VER=3b19ddcf67e33934f268b09d3364cd87275d48db
5ARG TREX_EXT_LIBS=/external_libs
6ARG TREX_LIBS=/trex_python
Yi Tsengaae6ef52021-09-01 13:48:27 -07007ARG KUBECTL=v1.22.1
Daniele Moroe734b7f2021-09-07 17:53:20 +02008
9# Install TRex deps
10FROM alpine:3.12.1 as trex-builder
11ARG TREX_VER
12ARG TREX_EXT_LIBS
13ARG TREX_LIBS
14# Install Trex library
15ENV TREX_SCRIPT_DIR=/trex-core-${TREX_VER}/scripts
16RUN wget https://github.com/stratum/trex-core/archive/${TREX_VER}.zip
17RUN unzip -qq ${TREX_VER}.zip && \
18 mkdir -p /output/${TREX_EXT_LIBS} && \
19 mkdir -p /output/${TREX_LIBS} && \
20 cp -r ${TREX_SCRIPT_DIR}/automation/trex_control_plane/interactive/* /output/${TREX_LIBS} && \
21 cp -r ${TREX_SCRIPT_DIR}/external_libs/* /output/${TREX_EXT_LIBS} && \
22 cp -r ${TREX_SCRIPT_DIR}/automation/trex_control_plane/stf/trex_stf_lib /output/${TREX_LIBS}
23
24FROM ubuntu:20.04
25ARG TREX_EXT_LIBS
26ARG TREX_LIBS
27ARG SCAPY_VER
28ARG KUBECTL
Yi Tsengaae6ef52021-09-01 13:48:27 -070029ENV PACKAGES \
30 python \
Daniele Moroe734b7f2021-09-07 17:53:20 +020031 python3 \
32 python3-pip \
Yi Tsengaae6ef52021-09-01 13:48:27 -070033 ssh \
34 openssh-server \
35 curl \
Daniele Moroe734b7f2021-09-07 17:53:20 +020036 supervisor \
37 git
Yi Tsengaae6ef52021-09-01 13:48:27 -070038ADD requirements.txt /
39
Daniele Moroe734b7f2021-09-07 17:53:20 +020040COPY --from=trex-builder /output /
41
Yi Tsengaae6ef52021-09-01 13:48:27 -070042RUN apt update && \
43 apt install --no-install-recommends -y $PACKAGES && \
44 curl -L "https://dl.k8s.io/release/$KUBECTL/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl && \
45 chmod 0755 /usr/local/bin/kubectl && \
Daniele Moroe734b7f2021-09-07 17:53:20 +020046 curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python && \
Yi Tsengaae6ef52021-09-01 13:48:27 -070047 python -m pip install setuptools && \
Daniele Moroe734b7f2021-09-07 17:53:20 +020048 python -m pip install -r requirements.txt && \
49 python3 -m pip install p4runtime-shell==0.0.2 && \
50 cd ${TREX_EXT_LIBS}/scapy-${SCAPY_VER} && python setup.py install && \
Yi Tsengaae6ef52021-09-01 13:48:27 -070051 mkdir -p /var/run/sshd && \
52 mkdir -p /var/log/supervisor && \
53 useradd -m jenkins && \
Daniele Moroc99bf822021-10-11 23:21:15 +020054 chmod 777 /tmp && \
Yi Tsengaae6ef52021-09-01 13:48:27 -070055 chsh -s /bin/bash jenkins && \
56 echo jenkins:jenkins | chpasswd
57
Daniele Moroc99bf822021-10-11 23:21:15 +020058RUN curl -sS --fail "https://repo1.maven.org/maven2/org/onosproject/onos-releases/2.5.4/onos-admin-2.5.4.tar.gz" | tar zx && \
59 mv onos-admin-2.5.4/* /usr/local/bin/ && \
60 rm -r onos-admin-2.5.4
61
Daniele Moroe734b7f2021-09-07 17:53:20 +020062ENV PYTHONPATH=${TREX_EXT_LIBS}:${TREX_LIBS}
63# TODO: should we parametrize those?
64ENV OC1=localhost
65ENV OC2=localhost
66ENV OC3=localhost
Yi Tsengaae6ef52021-09-01 13:48:27 -070067ADD docker/fs /
68RUN chown -R jenkins.jenkins /home/jenkins && \
69 python -m pip install -r /tmp/additional-py-pkgs.txt
70
71CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
72
73EXPOSE 22