aboutsummaryrefslogtreecommitdiff
path: root/tcwg-base/Dockerfile.in
blob: 034d4f10993ad90dc95e8e0c590381e65a081f6e (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
#if DISTRO_xenial
# if ARCH_amd64
FROM ubuntu:#{DISTRO}
# else
FROM linaro/base-#{ARCH}-ubuntu:#{DISTRO}
# endif
#else
# if ARCH_armhf
FROM arm32v7/ubuntu:#{DISTRO}
# else
FROM ubuntu:#{DISTRO}
# endif
#endif

#if DISTRO_xenial
#if ARCH_amd64 || ARCH_i386
RUN (url="http://archive.ubuntu.com/ubuntu/"; \
#else
RUN (url="http://ports.ubuntu.com/ubuntu-ports/"; \
#endif
 ubuntu=#{DISTRO}; \
 for i in $ubuntu $ubuntu-updates $ubuntu-backports $ubuntu-security; do \
   for j in deb deb-src; do \
     echo "$j $url $i main restricted universe multiverse"; \
   done; \
   echo; \
 done) > /etc/apt/sources.list \
#else
# Unminimize Ubuntu Bionic to install contrib files of git (after package
# update, otherwise unminimize's "apt upgrade" might fail).
RUN true \
#endif
 && apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y \
#if !DISTRO_xenial
 && echo y | unminimize \
#endif
#if ARCH_i386
 && dpkg-divert --local --rename --add /sbin/initctl \
 && ln -s /bin/true /sbin/initctl \
#endif
 && DEBIAN_FRONTEND=noninteractive apt-get install -y devscripts \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 alien \
 autoconf \
 autogen \
 automake \
 bc \
 bind9-host \
 bison \
#if ARCH_amd64 || ARCH_i386
 binutils-aarch64-linux-gnu \
 binutils-arm-linux-gnueabihf \
#endif
 binutils-dev \
 bsd-mailx \
 build-essential \
 byacc \
 ccache \
 ccrypt \
 chrpath \
 clang \
#if !DISTRO_xenial && !DISTRO_bionic
 cmake \
#endif
 curl \
 debhelper \
 dejagnu \
 dh-autoreconf \
 dh-translations \
 distro-info-data \
 emacs \
 fakeroot \
 flex \
 gawk \
 gdb \
 gdbserver \
 git \
 groff \
 less \
 libexpat1-dev \
 libffi-dev \
 libglib2.0-dev \
 libgmp-dev \
 liblzma-dev \
 libmpc-dev \
 libmpfr-dev \
 libncurses5-dev \
 libpixman-1-dev \
 libpython2.7-dev \
 libreadline-dev \
 libssl-dev \
 libtcnative-1 \
 libtool \
 locales \
 lzop \
 make \
#if ARCH_amd64 || ARCH_i386
 mingw-w64 \
#endif
 moreutils \
 net-tools \
 netcat \
 nfs-kernel-server \
 ninja-build \
 ntp \
 openjdk-8-jdk \
 openssh-server \
 pkg-config \
 postfix \
 psmisc \
#if DISTRO_xenial || DISTRO_bionic
 pxz \
 python-dev \
 python-pip \
 python-setuptools \
 python-wheel \
#else
# pxz \
 python2-dev \
# python2-pip \
# python2-setuptools \
# python2-wheel \
#endif
 python3-dev \
 python3-pip \
 python3-setuptools \
 python3-wheel \
 rsync \
 subversion \
 sudo \
 swig \
 tclsh \
 texinfo \
 texlive-fonts-recommended \
 texlive-latex-recommended \
 time \
 unifdef \
 valgrind \
 vim \
 virtualenv \
 wget \
 xz-utils \
 zip \
 zlib1g-dev \
 shellcheck \
# Update tzdata, because some base images have an incorrect file for UTC.
 && DEBIAN_FRONTEND=noninteractive apt-get install --reinstall tzdata \
 && rm -f /etc/ssh/ssh_host_*_key* \
 && apt-get clean \
 && rm -rf \
 /var/lib/apt/lists/* \
 /tmp/* \
 /var/tmp/*

RUN install -D -p -m0755 /usr/share/doc/git/contrib/workdir/git-new-workdir /usr/local/bin/git-new-workdir \
 && sed -i -e 's:^session *required *pam_loginuid.so:# session required pam_loginuid.so:' /etc/pam.d/sshd \
 && mkdir -p /var/run/sshd \
 && sed -i \
 -e "/.*MaxStartups.*/d" \
 -e "/.*MaxSessions.*/d" /etc/ssh/sshd_config \
 && echo "MaxStartups 256" >> /etc/ssh/sshd_config \
 && echo "MaxSessions 256" >> /etc/ssh/sshd_config \
 && locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8 \
 && pip3 install git-review \
 && pip3 install psutil

#if !DISTRO_xenial
# Install jipdate.  It is tricky to make these work
# for Trusty and Xenial, so don't bother.
RUN git clone -b master https://github.com/Linaro/jipdate.git /usr/local/jipdate/ \
 && git -C /usr/local/jipdate/ fetch origin pull/36/head:pull-36 \
 && git -C /usr/local/jipdate/ checkout pull-36 \
 && pip3 install -U -r /usr/local/jipdate/requirements.txt \
 && ln -s /usr/local/jipdate/jipdate.py /usr/local/bin/jipdate.py
#endif

COPY postfix-main.cf.in /etc/postfix/main.cf
COPY postfix-sasl_password.in /etc/postfix/sasl_password

RUN chown root:root /etc/postfix/sasl_password \
 && chmod 600 /etc/postfix/sasl_password

# Add ninja with support for memory-threshold job limitation.
# It's installed with ".bin" extension and containers then
# make wrappers around it in /usr/local/bin/ninja as needed.
RUN git clone -b master https://github.com/maxim-kuvyrkov/ninja.git \
 && cd ninja \
 && ./configure.py --bootstrap && ./ninja all && ./ninja_test \
 && mv ninja /usr/local/bin/ninja.bin \
 && cd .. \
 && rm -rf ninja

#if ARCH_amd64
# Build latest QEMU release (and install pre-requisites for the build).
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 && mkdir /tmp/docker-install-qemu.$$ \
 && cd /tmp/docker-install-qemu.$$ \
 && qemu_ver=4.2.0 \
 && wget --progress=dot:giga http://download.qemu-project.org/qemu-${qemu_ver}.tar.xz \
 && tar xf qemu-${qemu_ver}.tar.xz \
 && mkdir build && cd build \
 && ../qemu-${qemu_ver}/configure --prefix=/usr/local --target-list=aarch64-softmmu,arm-softmmu,aarch64-linux-user,aarch64_be-linux-user,arm-linux-user,armeb-linux-user \
 && make all install -j $(nproc --all) \
 && apt-get clean \
 && rm -rf \
 /tmp/docker-install-qemu.$$ \
 /var/lib/apt/lists/* \
 /tmp/* \
 /var/tmp/*
#endif

#if DISTRO_bionic
# Configure linux tools for benchmarking support.
#
# We symlink linux tools to supportted "hw_tags": tk1_32, tx1_64, tx1_32.
# HW_TAGS represent tested configurations of hardware+kernel+perf that
# work well together.  We create new hw_tag for any variation in hardware,
# kernel, or perf.  This gives us assurance that benchmarking data stored
# under bkp-01.tcwglab:results-<HW_TAG>/ directory has no unexpected variations.
#
# For the initial hw_tags for TK1s and TX1s we can use nice short tk1_32,
# tx1_64, and tx1_32 names, but if we update, say, perf version, we would
# need to add something like tk1_32-lt_5.4 (updating linux-tools to 5.4) or
# tx1_64-k_4.10 (updating kernel to 4.10).
#
# Below linux-tools versions have proven to work well with TK1s' 3.10 and
# TX1s' 4.4 kernels.
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# cpufrequtils is used by our benchmarking scripts, but we should update them to
# use cpupower from linux-tools everywhere instead.
 cpufrequtils \
 linux-tools-common \
 linux-tools-4.18.0-13-generic \
 && apt-get clean \
 && rm -rf \
 /var/lib/apt/lists/* \
 /tmp/* \
 /var/tmp/* \
 && ln -s /usr/lib/linux-tools/4.18.0-13-generic /usr/lib/linux-tools/tk1_32 \
 && ln -s /usr/lib/linux-tools/4.18.0-13-generic /usr/lib/linux-tools/tx1_32 \
 && ln -s /usr/lib/linux-tools/4.18.0-13-generic /usr/lib/linux-tools/tx1_64
#endif
#if DISTRO_bionic
# if ARCH_amd64
# Install usb libs and OpenOCD on x86 hosts, used to target bare-metal boards.
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
 libusb-1.0 \
 libusb-dev \
 && apt-get clean \
 && rm -rf \
 /var/lib/apt/lists/* \
 /tmp/* \
 /var/tmp/*
RUN cd /tmp \
 && git clone --single-branch --depth 1 https://git.code.sf.net/p/openocd/code openocd \
 && cd /tmp/openocd \
 && ./bootstrap \
 && ./configure --enable-stlink \
 && make -j$(nproc --all) \
 && make -j$(nproc --all) install \
 && cd /tmp \
 && rm -rf /tmp/openocd
# endif
#endif

#if DISTRO_xenial || DISTRO_bionic
# Install cmake v3.16 (same as in upcoming Ubuntu Focal images)
# Don't build in parallel for the sake of armhf-01, which runs out of RAM
RUN cd /tmp \
 && git clone -b v3.16.6 --single-branch --depth 1 https://github.com/Kitware/CMake.git \
 && cd /tmp/CMake \
 && ./bootstrap --parallel=1 \
 && make -j1 \
 && make -j1 install \
 && cd /tmp \
 && rm -rf /tmp/CMake
#endif

COPY home-data/ /home-data/
COPY new-user.sh nvidia-power-cycle.sh nvidia-serial.sh /usr/local/bin/

RUN \
 while read line; do \
   new-user.sh --group $(echo "$line" | cut -d: -f 1,3); \
 done </home-data/group

# We use ssh multiplexing, which creates sockets in /tmp.  Overlayfs,
# which docker is using, can't host sockets, so we use a scratch mount
# for /tmp.  This requires that we add --rm option to "docker run"
# invocations (e.g., mark "Remove volumes" checkbox in docker plugin) to
# cleanup host directories used for the scratch mounts.
VOLUME /tmp

EXPOSE 22
#if ARCH_amd64 || ARCH_arm64
CMD ["/usr/sbin/sshd", "-D"]
#else
CMD ["linux32", "/usr/sbin/sshd", "-D"]
#endif