Dockerfile 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. # Dockerfile
  2. #
  3. # Purpose
  4. # -------
  5. # Defines a Docker container suitable to build and run all tests (all.sh),
  6. # except for those that use a proprietary toolchain.
  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.
  11. # Copyright The Mbed TLS Contributors
  12. # SPDX-License-Identifier: Apache-2.0
  13. #
  14. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  15. # not use this file except in compliance with the License.
  16. # You may obtain a copy of the License at
  17. #
  18. # http://www.apache.org/licenses/LICENSE-2.0
  19. #
  20. # Unless required by applicable law or agreed to in writing, software
  21. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  22. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. # See the License for the specific language governing permissions and
  24. # limitations under the License.
  25. ARG MAKEFLAGS_PARALLEL=""
  26. ARG MY_REGISTRY=
  27. FROM ${MY_REGISTRY}ubuntu:bionic
  28. ENV DEBIAN_FRONTEND noninteractive
  29. RUN apt-get update \
  30. && apt-get -y install software-properties-common \
  31. && rm -rf /var/lib/apt/lists
  32. RUN add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
  33. RUN apt-get update \
  34. && apt-get -y install \
  35. # mbedtls build/test dependencies
  36. build-essential \
  37. clang \
  38. cmake \
  39. doxygen \
  40. gcc-arm-none-eabi \
  41. gcc-mingw-w64-i686 \
  42. gcc-multilib \
  43. g++-multilib \
  44. gdb \
  45. git \
  46. graphviz \
  47. lsof \
  48. python \
  49. python3-pip \
  50. python3 \
  51. pylint3 \
  52. valgrind \
  53. wget \
  54. # libnettle build dependencies
  55. libgmp-dev \
  56. m4 \
  57. pkg-config \
  58. && rm -rf /var/lib/apt/lists/*
  59. # Jinja2 is required for driver dispatch code generation.
  60. RUN python3 -m pip install \
  61. jinja2==2.10.1 types-jinja2
  62. # Build a static, legacy openssl from sources with sslv3 enabled
  63. # Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh)
  64. # Note: openssl-1.0.2 and earlier has known build issues with parallel make.
  65. RUN cd /tmp \
  66. && wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1j.tar.gz -qO- | tar xz \
  67. && cd openssl-1.0.1j \
  68. && ./config --openssldir=/usr/local/openssl-1.0.1j no-shared \
  69. && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \
  70. && make install_sw \
  71. && rm -rf /tmp/openssl*
  72. ENV OPENSSL_LEGACY=/usr/local/openssl-1.0.1j/bin/openssl
  73. # Build OPENSSL as 1.0.2g
  74. RUN cd /tmp \
  75. && wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2g.tar.gz -qO- | tar xz \
  76. && cd openssl-1.0.2g \
  77. && ./config --openssldir=/usr/local/openssl-1.0.2g no-shared \
  78. && (make ${MAKEFLAGS_PARALLEL} || make -j 1) \
  79. && make install_sw \
  80. && rm -rf /tmp/openssl*
  81. ENV OPENSSL=/usr/local/openssl-1.0.2g/bin/openssl
  82. # Build a new openssl binary for ARIA/CHACHA20 support
  83. # Based on https://gist.github.com/bmaupin/8caca3a1e8c3c5686141 (build-openssl.sh)
  84. RUN cd /tmp \
  85. && wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz -qO- | tar xz \
  86. && cd openssl-1.1.1a \
  87. && ./config --prefix=/usr/local/openssl-1.1.1a -Wl,--enable-new-dtags,-rpath,'${LIBRPATH}' no-shared \
  88. && make ${MAKEFLAGS_PARALLEL} \
  89. && make install_sw \
  90. && rm -rf /tmp/openssl*
  91. ENV OPENSSL_NEXT=/usr/local/openssl-1.1.1a/bin/openssl
  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. # Build legacy gnutls (3.3.8)
  102. RUN cd /tmp \
  103. && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz -qO- | tar xJ \
  104. && cd gnutls-3.3.8 \
  105. && ./configure --prefix=/usr/local/gnutls-3.3.8 --exec_prefix=/usr/local/gnutls-3.3.8 --disable-shared --disable-guile --disable-doc \
  106. && make ${MAKEFLAGS_PARALLEL} \
  107. && make install \
  108. && rm -rf /tmp/gnutls*
  109. ENV GNUTLS_LEGACY_CLI=/usr/local/gnutls-3.3.8/bin/gnutls-cli
  110. ENV GNUTLS_LEGACY_SERV=/usr/local/gnutls-3.3.8/bin/gnutls-serv
  111. # Build libnettle 3.1 (needed by gnutls)
  112. RUN cd /tmp \
  113. && wget https://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gz -qO- | tar xz \
  114. && cd nettle-3.1 \
  115. && ./configure --disable-documentation \
  116. && make ${MAKEFLAGS_PARALLEL} \
  117. && make install \
  118. && /sbin/ldconfig \
  119. && rm -rf /tmp/nettle*
  120. # Build gnutls (3.4.10)
  121. RUN cd /tmp \
  122. && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.10.tar.xz -qO- | tar xJ \
  123. && cd gnutls-3.4.10 \
  124. && ./configure --prefix=/usr/local/gnutls-3.4.10 --exec_prefix=/usr/local/gnutls-3.4.10 \
  125. --with-included-libtasn1 --without-p11-kit \
  126. --disable-shared --disable-guile --disable-doc \
  127. && make ${MAKEFLAGS_PARALLEL} \
  128. && make install \
  129. && rm -rf /tmp/gnutls*
  130. ENV GNUTLS_CLI=/usr/local/gnutls-3.4.10/bin/gnutls-cli
  131. ENV GNUTLS_SERV=/usr/local/gnutls-3.4.10/bin/gnutls-serv
  132. # Build libnettle 3.7.3 (needed by gnutls next)
  133. RUN cd /tmp \
  134. && wget https://ftp.gnu.org/gnu/nettle/nettle-3.7.3.tar.gz -qO- | tar xz \
  135. && cd nettle-3.7.3 \
  136. && ./configure --disable-documentation \
  137. && make ${MAKEFLAGS_PARALLEL} \
  138. && make install \
  139. && /sbin/ldconfig \
  140. && rm -rf /tmp/nettle*
  141. # Build gnutls next (3.7.2)
  142. RUN cd /tmp \
  143. && wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.2.tar.xz -qO- | tar xJ \
  144. && cd gnutls-3.7.2 \
  145. && ./configure --prefix=/usr/local/gnutls-3.7.2 --exec_prefix=/usr/local/gnutls-3.7.2 \
  146. --with-included-libtasn1 --with-included-unistring --without-p11-kit \
  147. --disable-shared --disable-guile --disable-doc \
  148. && make ${MAKEFLAGS_PARALLEL} \
  149. && make install \
  150. && rm -rf /tmp/gnutls*
  151. ENV GNUTLS_NEXT_CLI=/usr/local/gnutls-3.7.2/bin/gnutls-cli
  152. ENV GNUTLS_NEXT_SERV=/usr/local/gnutls-3.7.2/bin/gnutls-serv