blob: aa636ae3636547bbb686a94cee69de0e74ef53e8 [file] [log] [blame]
Leonardo Sandoval80223802021-12-07 13:18:06 -06001# ubuntu-18.04/Dockerfile
2#
3# Copyright (c) 2018-2021, ARM Limited, All Rights Reserved
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18# This file is part of Mbed TLS (https://www.trustedfirmware.org/projects/mbed-tls/)
19
20
21
22################################################################
23#### Documentation
24################################################################
25
26# Purpose
27# -------
28#
29# This docker file is for creating a ubuntu-18.04 platform container. It
30# contains setup and installation of tools for executing same set of Mbed TLS
31# tests as there are in the CI. This conatiner can be used for reproducing and
32# testing failures found in the CI.
33
34
35#Start with basic Ubuntu 18.04 image
36FROM ubuntu:18.04
37
38ENV DEBIAN_FRONTEND=noninteractive
39
40# Install necessary apt tools
41RUN apt-get update > /dev/null && \
42 apt-get install -y apt-transport-https \
43 apt-utils \
44 software-properties-common > /dev/null && \
45 apt-get clean && rm -rf /var/lib/apt/lists/
46
47# set the working directory to /opt/slave
48WORKDIR /opt/slave
49
50# Pre-approve Oracle Java license
51RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
52 echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
53
54# Install source control tools
55RUN apt-get update > /dev/null && \
56 apt-get install -y git > /dev/null && \
57 apt-get clean && rm -rf /var/lib/apt/lists/
58
59# Install Python 2.7
60RUN apt-get update > /dev/null && \
61 apt-get install -y python2.7 \
62 libffi-dev \
63 python-dev \
64 python-pip \
65 python-setuptools \
66 python-distutils-extra > /dev/null && \
67 apt-get clean && rm -rf /var/lib/apt/lists/
68
69# Install Python 3 pip
70RUN apt-get update > /dev/null && \
71 apt-get install -y python3-pip > /dev/null && \
72 apt-get clean && rm -rf /var/lib/apt/lists/
73
74# Install build tools
75RUN apt-get update > /dev/null && \
76 apt-get install -y cmake \
77 make \
78 valgrind \
79 doxygen \
80 graphviz \
81 lcov \
82 abi-dumper \
83 gcc-mingw-w64-i686 \
84 clang \
85 wget \
86 lsof > /dev/null && \
87 apt-get clean && rm -rf /var/lib/apt/lists/
88
89# Install ARM Compiler 5.06
90RUN dpkg --add-architecture i386 && \
91 apt-get update > /dev/null && \
92 apt-get install -y libc6-i386 \
93 libc6:i386 \
94 libstdc++6:i386 > /dev/null && \
95 apt-get clean && rm -rf /var/lib/apt/lists/
96
97RUN wget -q https://developer.arm.com/-/media/Files/downloads/compiler/DS500-PA-00003-r5p0-22rel0.tgz && \
98 tar -zxf DS500-PA-00003-r5p0-22rel0.tgz && \
99 ./Installer/setup.sh --i-agree-to-the-contained-eula --no-interactive -d /usr/local/ARM_Compiler_5.06u3 --quiet && \
100 rm -rf DS500-PA-00003-r5p0-22rel0.tgz releasenotes.html Installer/
101
102ENV ARMC5_BIN_DIR=/usr/local/ARM_Compiler_5.06u3/bin/
103ENV PATH=$PATH:/usr/local/ARM_Compiler_5.06u3/bin
104ENV ARMLMD_LICENSE_FILE=27000@flexnet.trustedfirmware.org
105
106# Install ARM Compiler 6.6
107RUN mkdir temp && cd temp && \
108 wget -q --no-check-certificate https://developer.arm.com/-/media/Files/downloads/compiler/DS500-BN-00026-r5p0-07rel0.tgz?revision=8f0d9fb0-9616-458c-b2f5-d0dac83ea93c?product=Downloads,64-bit,,Linux,6.6 -O arm6.tgz && \
109 tar -zxf arm6.tgz && ls -ltr && \
110 ./install_x86_64.sh --i-agree-to-the-contained-eula --no-interactive -d /usr/local/ARM_Compiler_6.6 --quiet && \
111 cd .. && rm -rf temp/
112
113ENV ARMC6_BIN_DIR=/usr/local/ARM_Compiler_6.6/bin/
114
115# Install arm-none-eabi-gcc
116RUN wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q3/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 -O gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 && \
117 tar -xjf gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2 -C /opt
118
119ENV PATH=/opt/gcc-arm-none-eabi-5_4-2016q3/bin:$PATH
120
121# Install openssl 1.0.2g
122RUN apt-get update > /dev/null && \
123 apt-get install -y gcc-multilib \
124 p11-kit \
125 libgmp10 \
126 libgmp-dev \
127 pkg-config \
128 m4 \
129 libp11-kit-dev > /dev/null && \
130 apt-get clean && rm -rf /var/lib/apt/lists/
131
132RUN wget -q https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz && \
133 tar -zxf openssl-1.0.2g.tar.gz && cd openssl-1.0.2g && \
134 ./config --openssldir=/usr/local/openssl-1.0.2g && \
135 make clean && make && make install && cd .. && \
136 rm -rf openssl-1.0.2g*
137
138ENV OPENSSL=/usr/local/openssl-1.0.2g/bin/openssl
139ENV PATH=/usr/local/openssl-1.0.2g/bin:$PATH
140
141# Install openssl 1.0.1j for legacy testing
142RUN wget -q https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz && \
143 tar -zxf openssl-1.0.1j.tar.gz && cd openssl-1.0.1j && \
144 ./config --openssldir=/usr/local/openssl-1.0.1j && \
145 make clean && make && make install && cd .. && \
146 rm -rf openssl-1.0.1j*
147
148ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl
149
150# Install openssl 1.1.1a for ARIA cipher testing
151RUN wget -q https://www.openssl.org/source/openssl-1.1.1a.tar.gz && \
152 tar -zxf openssl-1.1.1a.tar.gz && cd openssl-1.1.1a && \
153 ./config --prefix=/usr/local/openssl-1.1.1a -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' && \
154 make clean && make && make install && cd .. && \
155 rm -rf openssl-1.1.1a*
156
157ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl
158
159# Install Gnu TLS 3.4.10
160RUN wget -q https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz && \
161 tar -zxf nettle-3.1.tar.gz && cd nettle-3.1 && \
162 ./configure --prefix=/usr/local/libnettle-3.1 --exec_prefix=/usr/local/libnettle-3.1 --disable-shared && \
163 make && make install && cd .. && rm -rf nettle-3.1*
164
165ENV PKG_CONFIG_PATH=/usr/local/libnettle-3.1/lib/pkgconfig:/usr/local/libnettle-3.1/lib64/pkgconfig:/usr/local/lib/pkgconfig
166
167RUN wget -q https://ftp.gnu.org/gnu/libtasn1/libtasn1-4.13.tar.gz && \
168 tar -zxf libtasn1-4.13.tar.gz && cd libtasn1-4.13 && \
169 ./configure && make && make install && \
170 cd .. && rm -rf libtasn1-4.13*
171
172RUN wget -q https://github.com/p11-glue/p11-kit/releases/download/0.23.10/p11-kit-0.23.10.tar.gz && \
173 tar -zxf p11-kit-0.23.10.tar.gz && cd p11-kit-0.23.10 && \
174 ./configure --prefix=/usr/local/libp11-kit-0.23.10 && make && make install && \
175 cd .. && rm -rf p11-kit-0.23.10*
176
177ENV PKG_CONFIG_PATH=/usr/local/lib/libp11-kit-0.23.10/lib/pkgconfig:/usr/local/lib/libp11-kit-0.23.10/lib64/pkgconfig:$PKG_CONFIG_PATH
178
179RUN wget -q https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.10.tar.xz && \
180 tar -xJf gnutls-3.4.10.tar.xz && cd gnutls-3.4.10 && \
181 ./configure --prefix=/usr/local/gnutls-3.4.10 --exec_prefix=/usr/local/gnutls-3.4.10 --disable-shared && \
182 make && make install && cat config.log && cd .. && \
183 rm -rf gnutls-3.4.10*
184
185ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli
186ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv
187ENV PATH=/usr/local/gnutls-3.4.10/bin:$PATH
188
189# Install Gnu TLS 3.3.8 for legacy testing
190RUN wget -q https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz && \
191 tar -zxf nettle-2.7.1.tar.gz && cd nettle-2.7.1 && \
192 ./configure --prefix=/usr/local/libnettle-2.7.1 --exec_prefix=/usr/local/libnettle-2.7.1 --disable-shared && \
193 make && make install && cd .. && rm -rf nettle-2.7.1*
194
195ENV PKG_CONFIG_PATH=/usr/local/libnettle-2.7.1/lib/pkgconfig:/usr/local/libnettle-2.7.1/lib64/pkgconfig:/usr/local/lib/pkgconfig
196
197RUN wget -q https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz && \
198 tar -xJf gnutls-3.3.8.tar.xz && cd gnutls-3.3.8 && \
199 ./configure --prefix=/usr/local/gnutls-3.3.8 --exec_prefix=/usr/local/gnutls-3.3.8 --disable-shared && \
200 make && make install && cat config.log && cd .. && \
201 rm -rf gnutls-3.3.8*
202
203ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli
204ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv
205
206# Instal GNU TLS 3.6.5 for broader interoperability testing
207RUN wget -q https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz && \
208 tar -zxf nettle-3.4.1.tar.gz && cd nettle-3.4.1 && \
209 ./configure --prefix=/usr/local/libnettle-3.4.1 --exec_prefix=/usr/local/libnettle-3.4.1 --disable-shared && \
210 make && make install && cd .. && rm -rf nettle-3.4.1*
211
212ENV PKG_CONFIG_PATH=/usr/local/libnettle-3.4.1/lib/pkgconfig:/usr/local/libnettle-3.4.1/lib64/pkgconfig:/usr/local/lib/pkgconfig
213
214RUN apt-get update > /dev/null && \
215 apt-get install -y libunistring-dev > /dev/null && \
216 apt-get clean && rm -rf /var/lib/apt/lists/
217
218RUN wget -q https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz && \
219 tar -xJf gnutls-3.6.5.tar.xz && cd gnutls-3.6.5 && \
220 ./configure --prefix=/usr/local/gnutls-3.6.5 --exec_prefix=/usr/local/gnutls-3.6.5 --disable-shared && \
221 make && make install && cat config.log && cd .. && \
222 rm -rf gnutls-3.6.5*
223
224ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.6.5/bin/gnutls-cli
225ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.6.5/bin/gnutls-serv
226
227# Remove Ubuntu unattended-upgrades to prevent unwanted changes to system while it is running
228RUN apt-get purge -y unattended-upgrades
229
230
231# Install Python 2 pip packages
232# The pip wrapper scripts can get out of sync with pip due to upgrading it outside the package manager, so invoke the module directly
233RUN python2 -m pip install pip setuptools --upgrade > /dev/null
234
235RUN python2 -m pip install yotta matplotlib > /dev/null
236
237# Install Python pip packages
238#
239# The pip wrapper scripts can get out of sync with pip due to upgrading it
240# outside the package manager, so invoke the module directly.
241#
242# Ubuntu 18.04's pip (9.0.1) doesn't support suppressing the progress bar,
243# which is annoying in CI logs. Install pip<21, same as on Ubuntu 16.04
244# (although we could use a later version if we wanted).
245#
246# Piping to cat suppresses the progress bar, but means that a failure
247# won't be caught (`stuff | cat` succeeds if cat succeeds, even if `stuff`
248# fails). The subsequent use of "pip config" (which requires pip >=10)
249# will however fail if the installation of a more recent pip failed.
250RUN python3 -m pip install 'pip<21' --upgrade | cat && \
251 python3 -m pip config set global.progress_bar off && \
252 python3 -m pip install setuptools --upgrade && \
253 # For pylint we want a known version, as later versions may add checks at
254 # any time, making CI results unpredictable.
255 python3 -m pip install pylint==2.4.4 && \
256 # For mypy, use the earliest version that works with our code base.
257 # See https://github.com/ARMmbed/mbedtls/pull/3953 .
258 python3 -m pip install mypy==0.780 && \
259 # For jinja2, use the version that's in Ubuntu 20.04.
260 # See https://github.com/ARMmbed/mbedtls/pull/5067#discussion_r738794607 .
261 # Note that Jinja2 3.0 drops support for Python 3.5, so we need 2.x.
262 python3 -m pip install Jinja2==2.10.1 types-Jinja2 && \
263 true
264
265# Set the locale
266RUN apt-get clean && apt-get update && apt-get install -y locales zip python-tk
267RUN locale-gen en_US.UTF-8
268
269# Set locale for ARMCC to work
270RUN locale && locale-gen "en_US.UTF-8" && dpkg-reconfigure locales
271
272# Add user
273RUN useradd -m user
274
275# Create workspace
276ARG AGENT_WORKDIR=/var/lib/builds
277RUN mkdir -p ${AGENT_WORKDIR} && chown user:user ${AGENT_WORKDIR}
278USER user
279ENV AGENT_WORKDIR=${AGENT_WORKDIR}
280
281WORKDIR ${AGENT_WORKDIR}
282
283ENTRYPOINT ["bash"]