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