aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/docker_images/files/tg/Dockerfile
blob: 3ff0e2116d09780b323cba84f915de7082cbfbeb (plain)
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
98
99
100
101
102
103
# Import necessary base images
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ARG TREX_VERSION
ARG IPERF_VERSION

# Setup the environment
ENV DEBIAN_FRONTEND=noninteractive

# Configure locales
RUN apt-get update -qq \
 && apt-get install -y \
        apt-utils \
        locales \
 && sed -i 's/# \(en_US\.UTF-8 .*\)/\1/' /etc/locale.gen \
 && locale-gen en_US.UTF-8 \
 && dpkg-reconfigure --frontend=noninteractive locales \
 && update-locale LANG=en_US.UTF-8 \
 && TZ=Etc/UTC && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
 && rm -r /var/lib/apt/lists/*
ENV LANG="en_US.UTF-8" LANGUAGE="en_US" LC_ALL="en_US.UTF-8"

# Install packages and Docker
RUN apt-get -q update \
 && apt-get install -y -qq \
        apt-transport-https \
        bridge-utils \
        build-essential \
        ca-certificates \
        cmake \
        curl \
        dkms \
        ethtool \
        gcc-9 \
        g++-9 \
        libibverbs-dev \
        libnuma1 \
        libnuma-dev \
        libpcap-dev \
        net-tools \
        openssh-server \
        pciutils \
        python3-all \
        python3-apt \
        python3-dev \
        python3-pip \
        python3-setuptools \
        python3-virtualenv \
        rdma-core \
        rsyslog \
        screen \
        socat \
        software-properties-common \
        strace \
        ssh \
        sshpass \
        sudo \
        tar \
        unzip \
        wget \
        zlib1g-dev \
 && rm -rf /var/lib/apt/lists/*

# Fix permissions
RUN chown root:syslog /var/log \
 && chmod 755 /etc/default

# Create directory structure
RUN mkdir -p /var/run/sshd

# Install AB
RUN apt-get -q update \
 && apt-get install -y -qq \
        apache2-utils \
 && rm -rf /var/lib/apt/lists/*

# Install T-Rex
RUN wget -c https://github.com/cisco-system-traffic-generator/trex-core/archive/v${TREX_VERSION}.tar.gz -P /opt/ \
  && cd /opt/ \
  && tar xzfv v${TREX_VERSION}.tar.gz \
  && cd /opt/trex-core-${TREX_VERSION}/linux_dpdk/ \
  && ./b configure \
  && ./b build

# Install iPerf
RUN wget -c https://downloads.es.net/pub/iperf/iperf-${IPERF_VERSION}.tar.gz -P /opt/ \
  && cd /opt/ \
  && tar xzfv iperf-${IPERF_VERSION}.tar.gz \
  && cd /opt/iperf-${IPERF_VERSION} \
  && ./configure \
  && make \
  && make install

RUN groupadd -g 1000 testuser \
 && useradd -rm -d /home/testuser -s /bin/bash -g testuser -G sudo -u 1000 testuser \
 && echo 'testuser:Csit1234' | chpasswd

RUN echo 'root:Csit1234' | chpasswd \
 && sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
 && echo "export VISIBLE=now" >> /etc/profile

RUN service ssh start