1f72df8205a048600e8a5d939241d41a5739680a
[csit.git] / fdio.infra.ansible / roles / csit_sut_image / files / Dockerfile
1 # Copyright (c) 2022 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:22.04
15 LABEL Description="CSIT vpp-device ubuntu 22.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         libmbedcrypto7 \
51         libmbedtls14 \
52         libmbedx509-1 \
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.18.0 \
100         paramiko==2.9.3 \
101         pycrypto==2.6.1 \
102         PyYAML==5.4.1 \
103         requests==2.25.1 \
104         robotframework==5.0.1 \
105         scapy==2.4.5 \
106         scp==0.14.4 \
107         ansible==5.10.0 \
108         ansible-core==2.12.7 \
109         dill==0.3.5.1 \
110         numpy==1.22.4 \
111         scipy==1.8.1 \
112         boto3==1.17.78 \
113         botocore==1.20.78 \
114         hdrhistogram==0.6.1 \
115         pandas==1.4.2 \
116         plotly==4.1.1 \
117         PTable==0.9.2 \
118         Sphinx==3.5.4 \
119         sphinx-rtd-theme==0.5.2 \
120         sphinxcontrib-applehelp==1.0.2 \
121         sphinxcontrib-devhelp==1.0.2 \
122         sphinxcontrib-htmlhelp==2.0.0 \
123         sphinxcontrib-jsmath==1.0.1 \
124         sphinxcontrib-programoutput==0.17 \
125         sphinxcontrib-qthelp==1.0.3 \
126         sphinxcontrib-robotdoc==0.11.0 \
127         sphinxcontrib-serializinghtml==1.1.5 \
128         ply==3.11 \
129         jsonschema==4.1.0 \
130         rfc3339-validator==0.1.4 \
131         rfc3987==1.3.8 \
132         alabaster==0.7.12 \
133         attrs==21.4.0 \
134         Babel==2.10.3 \
135         bcrypt==3.2.2 \
136         certifi==2022.6.15 \
137         cffi==1.15.1 \
138         chardet==4.0.0 \
139         cryptography==36.0.2 \
140         docutils==0.16 \
141         future==0.18.2 \
142         idna==2.10 \
143         imagesize==1.4.1 \
144         Jinja2==3.0.3 \
145         jmespath==0.10.0 \
146         MarkupSafe==2.1.1 \
147         packaging==21.3 \
148         pbr==5.9.0 \
149         pycparser==2.21 \
150         Pygments==2.12.0 \
151         PyNaCl==1.5.0 \
152         pyparsing==3.0.9 \
153         pyrsistent==0.18.1 \
154         python-dateutil==2.8.2 \
155         pytz==2022.1 \
156         resolvelib==0.5.4 \
157         retrying==1.3.3 \
158         s3transfer==0.4.2 \
159         six==1.16.0 \
160         snowballstemmer==2.2.0 \
161         urllib3==1.26.10
162
163 # SSH settings
164 RUN echo 'root:Csit1234' | chpasswd \
165  && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
166  && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
167  && echo "export VISIBLE=now" >> /etc/profile
168
169 EXPOSE 2222
170
171 COPY supervisord.conf /etc/supervisor/supervisord.conf
172
173 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"]