73ff5c5e86dcb656799fc7c3132fe592d9fc3624
[csit.git] / resources / tools / testbed-setup / ansible / roles / csit_sut_image / files / Dockerfile
1 # Copyright (c) 2021 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 FROM ubuntu:20.04
15 LABEL Description="CSIT vpp-device ubuntu 20.04 SUT image"
16 LABEL Version="master"
17
18 # Setup the environment
19 ENV DEBIAN_FRONTEND=noninteractive
20
21 # Configure locales
22 RUN apt-get update -qq \
23  && apt-get install -y \
24         apt-utils \
25         locales \
26  && sed -i 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen \
27  && locale-gen en_US.UTF-8 \
28  && dpkg-reconfigure --frontend=noninteractive locales \
29  && update-locale LANG=en_US.UTF-8 \
30  && TZ=Etc/UTC && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
31  && rm -r /var/lib/apt/lists/*
32 ENV LANG="en_US.UTF-8" LANGUAGE="en_US" LC_ALL="en_US.UTF-8"
33
34 # Install packages and Docker
35 RUN apt-get -q update \
36  && apt-get install -y -qq \
37         apt-transport-https \
38         bridge-utils \
39         ca-certificates \
40         cloud-init \
41         cmake \
42         curl \
43         dkms \
44         gdb \
45         gfortran \
46         libapr1 \
47         libblas-dev \
48         libffi-dev \
49         liblapack-dev \
50         libmbedcrypto3 \
51         libmbedtls12 \
52         libmbedx509-0 \
53         libnuma1 \
54         libnuma-dev \
55         libpcap-dev \
56         libpixman-1-dev \
57         libssl-dev \
58         locales \
59         net-tools \
60         openssh-server \
61         pciutils \
62         python3-all \
63         python3-apt \
64         python3-cffi \
65         python3-cffi-backend \
66         python3-dev \
67         python3-pip \
68         python3-setuptools \
69         python3-virtualenv \
70         qemu-system \
71         rsyslog \
72         socat \
73         software-properties-common \
74         strongswan \
75         ssh \
76         sshpass \
77         sudo \
78         supervisor \
79         tar \
80         tcpdump \
81         unzip \
82         vim \
83         wget \
84         zlib1g-dev \
85  && curl -fsSL https://get.docker.com | sh \
86  && rm -rf /var/lib/apt/lists/*
87
88 # Fix permissions
89 RUN chown root:syslog /var/log \
90  && chmod 755 /etc/default
91
92 # Create directory structure
93 RUN mkdir -p /tmp/dumps \
94  && mkdir -p /var/cache/vpp/python \
95  && mkdir -p /var/run/sshd
96
97 # CSIT PIP pre-cache
98 RUN pip3 install \
99         ecdsa==0.13.3 \
100         paramiko==2.6.0 \
101         pycrypto==2.6.1 \
102         pypcap==1.2.3 \
103         PyYAML==5.1.1 \
104         requests==2.22.0 \
105         robotframework==3.1.2 \
106         scapy==2.4.3 \
107         scp==0.13.2 \
108         ansible==2.10.7 \
109         dill==0.2.8.2 \
110         numpy==1.17.3 \
111         hdrhistogram==0.6.1 \
112         plotly==4.1.1 \
113         PTable==0.9.2 \
114         Sphinx==2.2.1 \
115         sphinx-rtd-theme==0.4.0 \
116         sphinxcontrib-programoutput==0.15 \
117         sphinxcontrib-robotdoc==0.11.0 \
118         ply==3.11 \
119         alabaster==0.7.12 \
120         Babel==2.7.0 \
121         bcrypt==3.1.7 \
122         certifi==2019.9.11 \
123         cffi==1.13.2 \
124         chardet==3.0.4 \
125         cryptography==2.8 \
126         docutils==0.15.2 \
127         future==0.18.2 \
128         idna==2.8 \
129         imagesize==1.1.0 \
130         Jinja2==2.10.3 \
131         MarkupSafe==1.1.1 \
132         packaging==19.2 \
133         pbr==5.4.3 \
134         pycparser==2.19 \
135         Pygments==2.4.2 \
136         PyNaCl==1.3.0 \
137         pyparsing==2.4.4 \
138         python-dateutil==2.8.1 \
139         pytz==2019.3 \
140         retrying==1.3.3 \
141         six==1.13.0 \
142         snowballstemmer==2.0.0 \
143         sphinxcontrib-applehelp==1.0.1 \
144         sphinxcontrib-devhelp==1.0.1 \
145         sphinxcontrib-htmlhelp==1.0.2 \
146         sphinxcontrib-jsmath==1.0.1 \
147         sphinxcontrib-qthelp==1.0.2 \
148         sphinxcontrib-serializinghtml==1.1.3 \
149         urllib3==1.25.6
150
151 # ARM workaround
152 RUN pip3 install \
153         pandas==0.25.3 \
154         scipy==1.5.4
155
156 # SSH settings
157 RUN echo 'root:Csit1234' | chpasswd \
158  && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
159  && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
160  && echo "export VISIBLE=now" >> /etc/profile
161
162 EXPOSE 2222
163
164 COPY supervisord.conf /etc/supervisor/supervisord.conf
165
166 CMD ["sh", "-c", "rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api; /usr/bin/supervisord -c /etc/supervisor/supervisord.conf; /usr/sbin/sshd -D -p 2222"]