blob: 1b2d40f28c95af707081b485e2cce5537b08b1e0 [file] [log] [blame]
Peter Kolbus4225b1a2019-05-31 06:38:06 -05001# Dockerfile
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -06002#
3# Purpose
Peter Kolbus4225b1a2019-05-31 06:38:06 -05004# -------
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -06005# Defines a Docker container suitable to build and run all tests (all.sh),
6# except for those that use a proprietary toolchain.
7
Peter Kolbus4225b1a2019-05-31 06:38:06 -05008# Copyright (C) 2006-2019, Arm Limited (or its affiliates), All Rights Reserved.
9# SPDX-License-Identifier: Apache-2.0
10#
11# Licensed under the Apache License, Version 2.0 (the "License"); you may
12# not use this file except in compliance with the License.
13# You may obtain a copy of the License at
14#
15# http://www.apache.org/licenses/LICENSE-2.0
16#
17# Unless required by applicable law or agreed to in writing, software
18# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
19# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20# See the License for the specific language governing permissions and
21# limitations under the License.
22#
23# This file is part of Mbed TLS (https://tls.mbed.org)
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060024ARG MAKEFLAGS_PARALLEL=""
Peter Kolbus718c74c2019-06-29 11:26:51 -050025ARG MY_REGISTRY=
26
27FROM ${MY_REGISTRY}ubuntu:bionic
28
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060029
30ENV DEBIAN_FRONTEND noninteractive
31
Peter Kolbusbe543582019-06-29 11:09:01 -050032RUN apt-get update \
33 && apt-get -y install software-properties-common \
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060034 && rm -rf /var/lib/apt/lists
35
36RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
37
38RUN apt-get update \
39 && apt-get -y install \
40 # mbedtls build/test dependencies
41 build-essential \
42 clang \
43 cmake \
44 doxygen \
45 gcc-arm-none-eabi \
46 gcc-mingw-w64-i686 \
47 gcc-multilib \
48 g++-multilib \
49 gdb \
50 git \
51 graphviz \
52 lsof \
53 python \
54 python3-pip \
55 python3 \
56 pylint3 \
57 valgrind \
58 wget \
59 # libnettle build dependencies
60 libgmp-dev \
61 m4 \
62 pkg-config \
63 && rm -rf /var/lib/apt/lists/*
64
65# Build a static, legacy openssl from sources with sslv3 enabled
66# Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh)
67# Note: openssl-1.0.2 and earlier has known build issues with parallel make.
68RUN cd /tmp \
69 && wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz -qO- | tar xz \
70 && cd openssl-1.0.1j \
71 && ./config --openssldir=/usr/local/openssl-1.0.1j no-shared \
72 && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \
73 && make install_sw \
74 && rm -rf /tmp/openssl*
75ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl
76
77# Build OPENSSL as 1.0.2g
78RUN cd /tmp \
79 && wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz -qO- | tar xz \
80 && cd openssl-1.0.2g \
81 && ./config --openssldir=/usr/local/openssl-1.0.2g no-shared \
82 && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \
83 && make install_sw \
84 && rm -rf /tmp/openssl*
85ENV OPENSSL=/usr/local/openssl-1.0.2g/bin/openssl
86
87# Build a new openssl binary for ARIA/CHACHA20 support
88# Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh)
89RUN cd /tmp \
90 && wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz -qO- | tar xz \
91 && cd openssl-1.1.1a \
92 && ./config --prefix=/usr/local/openssl-1.1.1a -Wl,--enable-new-dtags,-rpath,'${LIBRPATH}' no-shared \
93 && make ${MAKEFLAGS_PARALLEL} \
94 && make install_sw \
95 && rm -rf /tmp/openssl*
96ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl
97
98# Build libnettle 2.7.1 (needed by legacy gnutls)
99RUN cd /tmp \
100 && wget https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz -qO- | tar xz \
101 && cd nettle-2.7.1 \
102 && ./configure --disable-documentation \
103 && make ${MAKEFLAGS_PARALLEL} \
104 && make install \
105 && /sbin/ldconfig \
106 && rm -rf /tmp/nettle*
107
108# Build legacy gnutls (3.3.8)
109RUN cd /tmp \
110 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz -qO- | tar xJ \
111 && cd gnutls-3.3.8 \
112 && ./configure --prefix=/usr/local/gnutls-3.3.8 --exec_prefix=/usr/local/gnutls-3.3.8 --disable-shared --disable-guile --disable-doc \
113 && make ${MAKEFLAGS_PARALLEL} \
114 && make install \
115 && rm -rf /tmp/gnutls*
116ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli
117ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv
118
119# Build libnettle 3.1 (needed by gnutls)
120RUN cd /tmp \
121 && wget https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz -qO- | tar xz \
122 && cd nettle-3.1 \
123 && ./configure --disable-documentation \
124 && make ${MAKEFLAGS_PARALLEL} \
125 && make install \
126 && /sbin/ldconfig \
127 && rm -rf /tmp/nettle*
128
129# Build gnutls (3.4.10)
130RUN cd /tmp \
131 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.10.tar.xz -qO- | tar xJ \
132 && cd gnutls-3.4.10 \
133 && ./configure --prefix=/usr/local/gnutls-3.4.10 --exec_prefix=/usr/local/gnutls-3.4.10 \
134 --with-included-libtasn1 --without-p11-kit \
135 --disable-shared --disable-guile --disable-doc \
136 && make ${MAKEFLAGS_PARALLEL} \
137 && make install \
138 && rm -rf /tmp/gnutls*
139ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli
140ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv
141
142# Build libnettle 3.4 (needed by gnutls next)
143RUN cd /tmp \
144 && wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz -qO- | tar xz \
145 && cd nettle-3.4.1 \
146 && ./configure --disable-documentation \
147 && make ${MAKEFLAGS_PARALLEL} \
148 && make install \
149 && /sbin/ldconfig \
150 && rm -rf /tmp/nettle*
151
152# Build gnutls next (3.6.5)
153RUN cd /tmp \
154 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz -qO- | tar xJ \
155 && cd gnutls-3.6.5 \
156 && ./configure --prefix=/usr/local/gnutls-3.6.5 --exec_prefix=/usr/local/gnutls-3.6.5 \
157 --with-included-libtasn1 --with-included-unistring --without-p11-kit \
158 --disable-shared --disable-guile --disable-doc \
159 && make ${MAKEFLAGS_PARALLEL} \
160 && make install \
161 && rm -rf /tmp/gnutls*
162
163ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.6.5/bin/gnutls-cli
164ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.6.5/bin/gnutls-serv
165
166RUN pip3 install --no-cache-dir \
167 mbed-host-tests \
168 mock