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. |
| 7 | |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 8 | # Copyright The Mbed TLS Contributors |
Peter Kolbus | 4225b1a | 2019-05-31 06:38:06 -0500 | [diff] [blame] | 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. |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 22 | ARG MAKEFLAGS_PARALLEL="" |
Peter Kolbus | 718c74c | 2019-06-29 11:26:51 -0500 | [diff] [blame] | 23 | ARG MY_REGISTRY= |
| 24 | |
| 25 | FROM ${MY_REGISTRY}ubuntu:bionic |
| 26 | |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 27 | |
| 28 | ENV DEBIAN_FRONTEND noninteractive |
| 29 | |
Peter Kolbus | be54358 | 2019-06-29 11:09:01 -0500 | [diff] [blame] | 30 | RUN apt-get update \ |
| 31 | && apt-get -y install software-properties-common \ |
Peter Kolbus | e4e2d3a | 2018-12-24 09:04:54 -0600 | [diff] [blame] | 32 | && rm -rf /var/lib/apt/lists |
| 33 | |
| 34 | RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa |
| 35 | |
| 36 | RUN apt-get update \ |
| 37 | && apt-get -y install \ |
| 38 | # mbedtls build/test dependencies |
| 39 | build-essential \ |
| 40 | clang \ |
| 41 | cmake \ |
| 42 | doxygen \ |
| 43 | gcc-arm-none-eabi \ |
| 44 | gcc-mingw-w64-i686 \ |
| 45 | gcc-multilib \ |
| 46 | g++-multilib \ |
| 47 | gdb \ |
| 48 | git \ |
| 49 | graphviz \ |
| 50 | lsof \ |
| 51 | python \ |
| 52 | python3-pip \ |
| 53 | python3 \ |
| 54 | pylint3 \ |
| 55 | valgrind \ |
| 56 | wget \ |
| 57 | # libnettle build dependencies |
| 58 | libgmp-dev \ |
| 59 | m4 \ |
| 60 | pkg-config \ |
| 61 | && rm -rf /var/lib/apt/lists/* |
| 62 | |
| 63 | # Build a static, legacy openssl from sources with sslv3 enabled |
| 64 | # Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh) |
| 65 | # Note: openssl-1.0.2 and earlier has known build issues with parallel make. |
| 66 | RUN cd /tmp \ |
| 67 | && wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz -qO- | tar xz \ |
| 68 | && cd openssl-1.0.1j \ |
| 69 | && ./config --openssldir=/usr/local/openssl-1.0.1j no-shared \ |
| 70 | && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \ |
| 71 | && make install_sw \ |
| 72 | && rm -rf /tmp/openssl* |
| 73 | ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl |
| 74 | |
| 75 | # Build OPENSSL as 1.0.2g |
| 76 | RUN cd /tmp \ |
| 77 | && wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz -qO- | tar xz \ |
| 78 | && cd openssl-1.0.2g \ |
| 79 | && ./config --openssldir=/usr/local/openssl-1.0.2g no-shared \ |
| 80 | && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \ |
| 81 | && make install_sw \ |
| 82 | && rm -rf /tmp/openssl* |
| 83 | ENV OPENSSL=/usr/local/openssl-1.0.2g/bin/openssl |
| 84 | |
| 85 | # Build a new openssl binary for ARIA/CHACHA20 support |
| 86 | # Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh) |
| 87 | RUN cd /tmp \ |
| 88 | && wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz -qO- | tar xz \ |
| 89 | && cd openssl-1.1.1a \ |
| 90 | && ./config --prefix=/usr/local/openssl-1.1.1a -Wl,--enable-new-dtags,-rpath,'${LIBRPATH}' no-shared \ |
| 91 | && make ${MAKEFLAGS_PARALLEL} \ |
| 92 | && make install_sw \ |
| 93 | && rm -rf /tmp/openssl* |
| 94 | ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl |
| 95 | |
| 96 | # Build libnettle 2.7.1 (needed by legacy gnutls) |
| 97 | RUN cd /tmp \ |
| 98 | && wget https://ftp.gnu.org/gnu/nettle/nettle-2.7.1.tar.gz -qO- | tar xz \ |
| 99 | && cd nettle-2.7.1 \ |
| 100 | && ./configure --disable-documentation \ |
| 101 | && make ${MAKEFLAGS_PARALLEL} \ |
| 102 | && make install \ |
| 103 | && /sbin/ldconfig \ |
| 104 | && rm -rf /tmp/nettle* |
| 105 | |
| 106 | # Build legacy gnutls (3.3.8) |
| 107 | RUN cd /tmp \ |
| 108 | && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz -qO- | tar xJ \ |
| 109 | && cd gnutls-3.3.8 \ |
| 110 | && ./configure --prefix=/usr/local/gnutls-3.3.8 --exec_prefix=/usr/local/gnutls-3.3.8 --disable-shared --disable-guile --disable-doc \ |
| 111 | && make ${MAKEFLAGS_PARALLEL} \ |
| 112 | && make install \ |
| 113 | && rm -rf /tmp/gnutls* |
| 114 | ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli |
| 115 | ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv |
| 116 | |
| 117 | # Build libnettle 3.1 (needed by gnutls) |
| 118 | RUN cd /tmp \ |
| 119 | && wget https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz -qO- | tar xz \ |
| 120 | && cd nettle-3.1 \ |
| 121 | && ./configure --disable-documentation \ |
| 122 | && make ${MAKEFLAGS_PARALLEL} \ |
| 123 | && make install \ |
| 124 | && /sbin/ldconfig \ |
| 125 | && rm -rf /tmp/nettle* |
| 126 | |
| 127 | # Build gnutls (3.4.10) |
| 128 | RUN cd /tmp \ |
| 129 | && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.10.tar.xz -qO- | tar xJ \ |
| 130 | && cd gnutls-3.4.10 \ |
| 131 | && ./configure --prefix=/usr/local/gnutls-3.4.10 --exec_prefix=/usr/local/gnutls-3.4.10 \ |
| 132 | --with-included-libtasn1 --without-p11-kit \ |
| 133 | --disable-shared --disable-guile --disable-doc \ |
| 134 | && make ${MAKEFLAGS_PARALLEL} \ |
| 135 | && make install \ |
| 136 | && rm -rf /tmp/gnutls* |
| 137 | ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli |
| 138 | ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv |
| 139 | |
| 140 | # Build libnettle 3.4 (needed by gnutls next) |
| 141 | RUN cd /tmp \ |
| 142 | && wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz -qO- | tar xz \ |
| 143 | && cd nettle-3.4.1 \ |
| 144 | && ./configure --disable-documentation \ |
| 145 | && make ${MAKEFLAGS_PARALLEL} \ |
| 146 | && make install \ |
| 147 | && /sbin/ldconfig \ |
| 148 | && rm -rf /tmp/nettle* |
| 149 | |
| 150 | # Build gnutls next (3.6.5) |
| 151 | RUN cd /tmp \ |
| 152 | && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.5.tar.xz -qO- | tar xJ \ |
| 153 | && cd gnutls-3.6.5 \ |
| 154 | && ./configure --prefix=/usr/local/gnutls-3.6.5 --exec_prefix=/usr/local/gnutls-3.6.5 \ |
| 155 | --with-included-libtasn1 --with-included-unistring --without-p11-kit \ |
| 156 | --disable-shared --disable-guile --disable-doc \ |
| 157 | && make ${MAKEFLAGS_PARALLEL} \ |
| 158 | && make install \ |
| 159 | && rm -rf /tmp/gnutls* |
| 160 | |
| 161 | ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.6.5/bin/gnutls-cli |
| 162 | ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.6.5/bin/gnutls-serv |
| 163 | |
| 164 | RUN pip3 install --no-cache-dir \ |
| 165 | mbed-host-tests \ |
| 166 | mock |