Dockerfile 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. # This Dockerfile specifies the recipe for creating an image for the tests
  2. # to run in.
  3. #
  4. # We install as many test dependencies here as we can, because these setup
  5. # steps can be cached. They do *not* run every time we run the build.
  6. # The Docker image is only rebuilt when the Dockerfile (ie. this file)
  7. # changes.
  8. # Base Dockerfile for gRPC dev images
  9. FROM debian:latest
  10. # Apt source for old Python versions.
  11. RUN echo 'deb http://ppa.launchpad.net/fkrull/deadsnakes/ubuntu trusty main' > /etc/apt/sources.list.d/deadsnakes.list && \
  12. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DB82666C
  13. # Apt source for Oracle Java.
  14. RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
  15. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
  16. echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
  17. # Apt source for Mono
  18. RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list && \
  19. echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list && \
  20. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
  21. # Apt source for php
  22. RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \
  23. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07
  24. # Install dotnet SDK based on https://www.microsoft.com/net/core#debian
  25. # (Ubuntu instructions need apt to support https)
  26. RUN apt-get update && apt-get install -y --force-yes curl libunwind8 gettext && \
  27. curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=847105 && \
  28. mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet && \
  29. ln -s /opt/dotnet/dotnet /usr/local/bin
  30. # Install dependencies. We start with the basic ones require to build protoc
  31. # and the C++ build
  32. RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
  33. autoconf \
  34. autotools-dev \
  35. build-essential \
  36. bzip2 \
  37. ccache \
  38. curl \
  39. gcc \
  40. git \
  41. libc6 \
  42. libc6-dbg \
  43. libc6-dev \
  44. libgtest-dev \
  45. libtool \
  46. make \
  47. parallel \
  48. time \
  49. wget \
  50. # -- For csharp --
  51. mono-devel \
  52. referenceassemblies-pcl \
  53. nunit \
  54. # -- For all Java builds -- \
  55. maven \
  56. # -- For java_jdk7 -- \
  57. openjdk-7-jdk \
  58. # -- For java_oracle7 -- \
  59. oracle-java7-installer \
  60. # -- For python / python_cpp -- \
  61. python-setuptools \
  62. python-pip \
  63. python-dev \
  64. python2.6-dev \
  65. python3.3-dev \
  66. python3.4-dev \
  67. # -- For Ruby --
  68. ruby \
  69. # -- For C++ benchmarks --
  70. cmake \
  71. # -- For PHP --
  72. php5.6 \
  73. php5.6-dev \
  74. php5.6-xml \
  75. php7.0 \
  76. php7.0-dev \
  77. php7.0-xml \
  78. phpunit \
  79. valgrind \
  80. libxml2-dev \
  81. && apt-get clean
  82. ##################
  83. # C# dependencies
  84. RUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe
  85. ##################
  86. # Python dependencies
  87. # These packages exist in apt-get, but their versions are too old, so we have
  88. # to get updates from pip.
  89. RUN pip install pip --upgrade
  90. RUN pip install virtualenv tox yattag
  91. ##################
  92. # Ruby dependencies
  93. # Install rvm
  94. RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  95. RUN \curl -sSL https://get.rvm.io | bash -s stable
  96. # Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
  97. RUN /bin/bash -l -c "rvm install ruby-2.1"
  98. RUN /bin/bash -l -c "rvm install ruby-2.2"
  99. RUN /bin/bash -l -c "rvm install jruby-1.7"
  100. RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
  101. RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
  102. RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
  103. ##################
  104. # Java dependencies
  105. # This step requires compiling protoc. :(
  106. ENV MAVEN_REPO /var/maven_local_repository
  107. ENV MVN mvn --batch-mode
  108. RUN cd /tmp && \
  109. git clone https://github.com/google/protobuf.git && \
  110. cd protobuf && \
  111. git reset --hard 129a6e2aca95dcfb6c3e717d7b9cca1f104fde39 && \
  112. ./autogen.sh && \
  113. ./configure && \
  114. make -j4 && \
  115. cd java && \
  116. $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
  117. cd ../javanano && \
  118. $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO
  119. ##################
  120. # PHP dependencies.
  121. RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
  122. RUN mv mirror php-5.5.38.tar.bz2
  123. RUN tar -xvf php-5.5.38.tar.bz2
  124. RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
  125. make && make install && cd ..
  126. RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
  127. make && make install && cd ..
  128. RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
  129. RUN mv mirror php-5.6.30.tar.bz2
  130. RUN tar -xvf php-5.6.30.tar.bz2
  131. RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
  132. make && make install && cd ..
  133. RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
  134. make && make install && cd ..
  135. RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
  136. RUN mv mirror php-7.0.18.tar.bz2
  137. RUN tar -xvf php-7.0.18.tar.bz2
  138. RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
  139. make && make install && cd ..
  140. RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
  141. make && make install && cd ..
  142. RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
  143. RUN mv mirror php-7.1.4.tar.bz2
  144. RUN tar -xvf php-7.1.4.tar.bz2
  145. RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \
  146. make && make install && cd ..
  147. RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \
  148. make && make install && cd ..
  149. RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  150. RUN php composer-setup.php
  151. RUN mv composer.phar /usr/bin/composer
  152. RUN php -r "unlink('composer-setup.php');"
  153. RUN composer config -g -- disable-tls true
  154. RUN composer config -g -- secure-http false
  155. RUN cd /tmp && \
  156. rm -rf protobuf && \
  157. git clone https://github.com/google/protobuf.git && \
  158. cd protobuf && \
  159. git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
  160. cd php && \
  161. ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
  162. ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
  163. ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
  164. composer install && \
  165. mv vendor /usr/local/vendor-5.5 && \
  166. ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
  167. ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
  168. ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
  169. composer install && \
  170. mv vendor /usr/local/vendor-5.6 && \
  171. ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
  172. ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
  173. ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
  174. composer install && \
  175. mv vendor /usr/local/vendor-7.0 && \
  176. ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \
  177. ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \
  178. ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \
  179. composer install && \
  180. mv vendor /usr/local/vendor-7.1
  181. ##################
  182. # Go dependencies.
  183. RUN apt-get install -y \
  184. # -- For go -- \
  185. golang
  186. ##################
  187. # Javascript dependencies.
  188. RUN apt-get install -y \
  189. # -- For javascript -- \
  190. npm
  191. ##################
  192. # Python 3.5 3.6 dependencies.
  193. RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
  194. python3.5-dev \
  195. python3.6-dev \
  196. && apt-get clean
  197. # On Debian/Ubuntu, nodejs binary is named 'nodejs' because the name 'node'
  198. # is taken by another legacy binary. We don't have that legacy binary and
  199. # npm expects the binary to be named 'node', so we just create a symbol
  200. # link here.
  201. RUN ln -s `which nodejs` /usr/bin/node
  202. ##################
  203. # Prepare ccache
  204. RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
  205. RUN ln -s /usr/bin/ccache /usr/local/bin/g++
  206. RUN ln -s /usr/bin/ccache /usr/local/bin/cc
  207. RUN ln -s /usr/bin/ccache /usr/local/bin/c++
  208. RUN ln -s /usr/bin/ccache /usr/local/bin/clang
  209. RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
  210. # Define the default command.
  211. CMD ["bash"]