Peter Kolbus | 4225b1a | 2019-05-31 06:38:06 -0500 | [diff] [blame] | 1 | # Dockerfile |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 2 | # |
| 3 | # Purpose |
Peter Kolbus | 4225b1a | 2019-05-31 06:38:06 -0500 | [diff] [blame] | 4 | # ------- |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 5 | # 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é-Gonnard | 59626b6 | 2022-12-15 10:08:26 +0100 | [diff] [blame] | 7 | # |
| 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 Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 11 | |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 12 | # Copyright The Mbed TLS Contributors |
Dave Rodgman | 16799db | 2023-11-02 19:47:20 +0000 | [diff] [blame^] | 13 | # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 14 | ARG MAKEFLAGS_PARALLEL="" |
Peter Kolbus | 718c74c | 2019-06-29 11:26:51 -0500 | [diff] [blame] | 15 | ARG MY_REGISTRY= |
| 16 | |
| 17 | FROM ${MY_REGISTRY}ubuntu:bionic |
| 18 | |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 19 | |
| 20 | ENV DEBIAN_FRONTEND noninteractive |
| 21 | |
Peter Kolbus | be54358 | 2019-06-29 11:09:01 -0500 | [diff] [blame] | 22 | RUN apt-get update \ |
| 23 | && apt-get -y install software-properties-common \ |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 24 | && rm -rf /var/lib/apt/lists |
| 25 | |
| 26 | RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa |
| 27 | |
| 28 | RUN 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 | |
Archana | 947cf61 | 2021-12-03 07:10:54 +0530 | [diff] [blame] | 55 | # Jinja2 is required for driver dispatch code generation. |
| 56 | RUN python3 -m pip install \ |
| 57 | jinja2==2.10.1 types-jinja2 |
| 58 | |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 59 | # 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. |
| 62 | RUN 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* |
| 69 | ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl |
| 70 | |
| 71 | # Build OPENSSL as 1.0.2g |
| 72 | RUN 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* |
| 79 | ENV 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) |
| 83 | RUN 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* |
| 90 | ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl |
| 91 | |
| 92 | # Build libnettle 2.7.1 (needed by legacy gnutls) |
| 93 | RUN 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) |
| 103 | RUN 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* |
| 110 | ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli |
| 111 | ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv |
| 112 | |
| 113 | # Build libnettle 3.1 (needed by gnutls) |
| 114 | RUN 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) |
| 124 | RUN 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* |
| 133 | ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli |
| 134 | ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv |
| 135 | |
Jerry Yu | ab46aa0 | 2021-08-17 10:48:26 +0800 | [diff] [blame] | 136 | # Build libnettle 3.7.3 (needed by gnutls next) |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 137 | RUN cd /tmp \ |
Jerry Yu | ab46aa0 | 2021-08-17 10:48:26 +0800 | [diff] [blame] | 138 | && wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz -qO- | tar xz \ |
| 139 | && cd nettle-3.7.3 \ |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 140 | && ./configure --disable-documentation \ |
| 141 | && make ${MAKEFLAGS_PARALLEL} \ |
| 142 | && make install \ |
| 143 | && /sbin/ldconfig \ |
| 144 | && rm -rf /tmp/nettle* |
| 145 | |
Jerry Yu | ab46aa0 | 2021-08-17 10:48:26 +0800 | [diff] [blame] | 146 | # Build gnutls next (3.7.2) |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 147 | RUN cd /tmp \ |
Jerry Yu | ab46aa0 | 2021-08-17 10:48:26 +0800 | [diff] [blame] | 148 | && 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 Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 151 | --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 Yu | ab46aa0 | 2021-08-17 10:48:26 +0800 | [diff] [blame] | 157 | ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.7.2/bin/gnutls-cli |
| 158 | ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.7.2/bin/gnutls-serv |