343ac1ba2d6ae5ee6d01d1622574b45fedf539d2
[csit.git] / resources / tools / disk-image-builder / csit-sut-dcr / ubuntu_1804_amd64 / Dockerfile
1 # Copyright (c) 2018 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:bionic-20180821
15
16 MAINTAINER csit-dev <csit-dev@lists.fd.io>
17 LABEL Description="CSIT vpp-device ubuntu 18.04 baseline image"
18 LABEL Version="0.3"
19
20 # Setup the environment
21 ENV DEBIAN_FRONTEND=noninteractive
22 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
23 ENV NOTVISIBLE "in users profile"
24 ENV VPP_PYTHON_PREFIX=/var/cache/vpp/python
25
26 # Base layer
27 RUN apt-get -q update \
28  && apt-get install -y -qq \
29         apt-transport-https \
30         curl \
31         software-properties-common \
32  && rm -rf /var/lib/apt/lists/*
33
34 # Repository settings
35 RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
36  && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
37  && apt-get remove -y \
38         curl
39
40 # Extended layer
41 RUN apt-get -q update \
42  && apt-get install -y -qq \
43         # general tools
44         bridge-utils \
45         cloud-init \
46         locales \
47         net-tools \
48         openssh-server \
49         pciutils \
50         rsyslog \
51         ssh \
52         sudo \
53         supervisor \
54         tar \
55         vim \
56         wget \
57         # csit requirements
58         cmake \
59         dkms \
60         docker-ce \
61         libpcap-dev \
62         libpython2.7-dev \
63         libpython-dev \
64         openjdk-8-jdk-headless \
65         python-pip \
66         python2.7-dev \
67         python-dev \
68         python-virtualenv \
69         qemu-system-x86 \
70         socat \
71         strongswan \
72         unzip \
73         tcpdump \
74         zlib1g-dev \
75         # vpp requirements
76         ca-certificates \
77         libapr1 \
78         libmbedcrypto1 \
79         libmbedtls10 \
80         libmbedx509-0 \
81         libnuma1 \
82  && rm -rf /var/lib/apt/lists/*
83
84 # Configure locales
85 RUN locale-gen en_US.UTF-8 \
86  && dpkg-reconfigure locales
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 # PIP pre-cache
98 RUN pip install \
99         robotframework==2.9.2 \
100         paramiko==1.16.0 \
101         scp==0.10.2 \
102         ipaddress==1.0.16 \
103         PyYAML==3.11 \
104         pykwalify==1.5.0 \
105         scapy==2.3.1 \
106         enum34==1.1.2 \
107         requests==2.9.1 \
108         ecdsa==0.13 \
109         pycrypto==2.6.1 \
110         pypcap==1.1.5
111
112 # SSH settings
113 RUN echo 'root:Csit1234' | chpasswd \
114  && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
115  && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd \
116  && echo "export VISIBLE=now" >> /etc/profile
117
118 EXPOSE 22
119
120 COPY supervisord.conf /etc/supervisord/supervisord.conf
121
122 CMD ["sh", "-c", "rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api; /usr/bin/supervisord -c /etc/supervisord/supervisord.conf; /usr/sbin/sshd -D"]