blob: e4c49fac2b611f78372ab65fb3bcb690b73232ef [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.
Manuel Pégourié-Gonnard59626b62022-12-15 10:08:26 +01007#
8# WARNING: this Dockerfile is no longer maintained! See
9# https://github.com/Mbed-TLS/mbedtls-test/blob/master/README.md#quick-start
10# for the set of Docker images we use on the CI.
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060011
Bence Szépkúti1e148272020-08-07 13:07:28 +020012# Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +000013# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060014ARG MAKEFLAGS_PARALLEL=""
Peter Kolbus718c74c2019-06-29 11:26:51 -050015ARG MY_REGISTRY=
16
17FROM ${MY_REGISTRY}ubuntu:bionic
18
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060019
20ENV DEBIAN_FRONTEND noninteractive
21
Peter Kolbusbe543582019-06-29 11:09:01 -050022RUN apt-get update \
23 && apt-get -y install software-properties-common \
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060024 && rm -rf /var/lib/apt/lists
25
26RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
27
28RUN apt-get update \
29 && apt-get -y install \
30 # mbedtls build/test dependencies
31 build-essential \
32 clang \
33 cmake \
34 doxygen \
35 gcc-arm-none-eabi \
36 gcc-mingw-w64-i686 \
37 gcc-multilib \
38 g++-multilib \
39 gdb \
40 git \
41 graphviz \
42 lsof \
43 python \
44 python3-pip \
45 python3 \
46 pylint3 \
47 valgrind \
48 wget \
49 # libnettle build dependencies
50 libgmp-dev \
51 m4 \
52 pkg-config \
53 && rm -rf /var/lib/apt/lists/*
54
Archana947cf612021-12-03 07:10:54 +053055# Jinja2 is required for driver dispatch code generation.
56RUN python3 -m pip install \
57 jinja2==2.10.1 types-jinja2
58
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -060059# Build a static, legacy openssl from sources with sslv3 enabled
60# Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh)
61# Note: openssl-1.0.2 and earlier has known build issues with parallel make.
62RUN cd /tmp \
63 && wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz -qO- | tar xz \
64 && cd openssl-1.0.1j \
65 && ./config --openssldir=/usr/local/openssl-1.0.1j no-shared \
66 && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \
67 && make install_sw \
68 && rm -rf /tmp/openssl*
69ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl
70
71# Build OPENSSL as 1.0.2g
72RUN cd /tmp \
73 && wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz -qO- | tar xz \
74 && cd openssl-1.0.2g \
75 && ./config --openssldir=/usr/local/openssl-1.0.2g no-shared \
76 && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \
77 && make install_sw \
78 && rm -rf /tmp/openssl*
79ENV OPENSSL=/usr/local/openssl-1.0.2g/bin/openssl
80
81# Build a new openssl binary for ARIA/CHACHA20 support
82# Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh)
83RUN cd /tmp \
84 && wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz -qO- | tar xz \
85 && cd openssl-1.1.1a \
86 && ./config --prefix=/usr/local/openssl-1.1.1a -Wl,--enable-new-dtags,-rpath,'${LIBRPATH}' no-shared \
87 && make ${MAKEFLAGS_PARALLEL} \
88 && make install_sw \
89 && rm -rf /tmp/openssl*
90ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl
91
92# Build libnettle 2.7.1 (needed by legacy gnutls)
93RUN cd /tmp \
94 && wget https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz -qO- | tar xz \
95 && cd nettle-2.7.1 \
96 && ./configure --disable-documentation \
97 && make ${MAKEFLAGS_PARALLEL} \
98 && make install \
99 && /sbin/ldconfig \
100 && rm -rf /tmp/nettle*
101
102# Build legacy gnutls (3.3.8)
103RUN cd /tmp \
104 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz -qO- | tar xJ \
105 && cd gnutls-3.3.8 \
106 && ./configure --prefix=/usr/local/gnutls-3.3.8 --exec_prefix=/usr/local/gnutls-3.3.8 --disable-shared --disable-guile --disable-doc \
107 && make ${MAKEFLAGS_PARALLEL} \
108 && make install \
109 && rm -rf /tmp/gnutls*
110ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli
111ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv
112
113# Build libnettle 3.1 (needed by gnutls)
114RUN cd /tmp \
115 && wget https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz -qO- | tar xz \
116 && cd nettle-3.1 \
117 && ./configure --disable-documentation \
118 && make ${MAKEFLAGS_PARALLEL} \
119 && make install \
120 && /sbin/ldconfig \
121 && rm -rf /tmp/nettle*
122
123# Build gnutls (3.4.10)
124RUN cd /tmp \
125 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.10.tar.xz -qO- | tar xJ \
126 && cd gnutls-3.4.10 \
127 && ./configure --prefix=/usr/local/gnutls-3.4.10 --exec_prefix=/usr/local/gnutls-3.4.10 \
128 --with-included-libtasn1 --without-p11-kit \
129 --disable-shared --disable-guile --disable-doc \
130 && make ${MAKEFLAGS_PARALLEL} \
131 && make install \
132 && rm -rf /tmp/gnutls*
133ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli
134ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv
135
Jerry Yuab46aa02021-08-17 10:48:26 +0800136# Build libnettle 3.7.3 (needed by gnutls next)
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -0600137RUN cd /tmp \
Jerry Yuab46aa02021-08-17 10:48:26 +0800138 && wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz -qO- | tar xz \
139 && cd nettle-3.7.3 \
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -0600140 && ./configure --disable-documentation \
141 && make ${MAKEFLAGS_PARALLEL} \
142 && make install \
143 && /sbin/ldconfig \
144 && rm -rf /tmp/nettle*
145
Jerry Yuab46aa02021-08-17 10:48:26 +0800146# Build gnutls next (3.7.2)
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -0600147RUN cd /tmp \
Jerry Yuab46aa02021-08-17 10:48:26 +0800148 && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz -qO- | tar xJ \
149 && cd gnutls-3.7.2 \
150 && ./configure --prefix=/usr/local/gnutls-3.7.2 --exec_prefix=/usr/local/gnutls-3.7.2 \
Peter Kolbuse4e2d3a2018-12-24 09:04:54 -0600151 --with-included-libtasn1 --with-included-unistring --without-p11-kit \
152 --disable-shared --disable-guile --disable-doc \
153 && make ${MAKEFLAGS_PARALLEL} \
154 && make install \
155 && rm -rf /tmp/gnutls*
156
Jerry Yuab46aa02021-08-17 10:48:26 +0800157ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.7.2/bin/gnutls-cli
158ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.7.2/bin/gnutls-serv