Dockerfile 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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_jdk6 -- \
  57. # oops! not in jessie. too old? openjdk-6-jdk \
  58. # -- For java_jdk7 -- \
  59. openjdk-7-jdk \
  60. # -- For java_oracle7 -- \
  61. oracle-java7-installer \
  62. # -- For python / python_cpp -- \
  63. python-setuptools \
  64. python-pip \
  65. python-dev \
  66. python2.6-dev \
  67. python3.3-dev \
  68. python3.4-dev \
  69. # -- For Ruby --
  70. ruby \
  71. # -- For C++ benchmarks --
  72. cmake \
  73. # -- For PHP --
  74. php5.6 \
  75. php5.6-dev \
  76. php5.6-xml \
  77. php7.0 \
  78. php7.0-dev \
  79. php7.0-xml \
  80. phpunit \
  81. valgrind \
  82. libxml2-dev \
  83. && apt-get clean
  84. ##################
  85. # C# dependencies
  86. RUN wget www.nuget.org/NuGet.exe -O /usr/local/bin/nuget.exe
  87. ##################
  88. # Python dependencies
  89. # These packages exist in apt-get, but their versions are too old, so we have
  90. # to get updates from pip.
  91. RUN pip install pip --upgrade
  92. RUN pip install virtualenv tox yattag
  93. ##################
  94. # Ruby dependencies
  95. # Install rvm
  96. RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  97. RUN \curl -sSL https://get.rvm.io | bash -s stable
  98. # Install Ruby 2.1, Ruby 2.2 and JRuby 1.7
  99. RUN /bin/bash -l -c "rvm install ruby-2.1"
  100. RUN /bin/bash -l -c "rvm install ruby-2.2"
  101. RUN /bin/bash -l -c "rvm install jruby-1.7"
  102. RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
  103. RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
  104. RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc"
  105. ##################
  106. # Java dependencies
  107. # This step requires compiling protoc. :(
  108. ENV MAVEN_REPO /var/maven_local_repository
  109. ENV MVN mvn --batch-mode
  110. RUN cd /tmp && \
  111. git clone https://github.com/google/protobuf.git && \
  112. cd protobuf && \
  113. git reset --hard c2b3b3e04e7a023efe06f2107705b45428847800 && \
  114. ./autogen.sh && \
  115. ./configure && \
  116. make -j4 && \
  117. cd java && \
  118. $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO && \
  119. cd ../javanano && \
  120. $MVN install dependency:go-offline -Dmaven.repo.local=$MAVEN_REPO
  121. ##################
  122. # PHP dependencies.
  123. RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
  124. RUN mv mirror php-5.5.38.tar.bz2
  125. RUN tar -xvf php-5.5.38.tar.bz2
  126. RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
  127. make && make install && cd ..
  128. RUN cd php-5.5.38 && make clean && ./configure --prefix=/usr/local/php-5.5 && \
  129. make && make install && cd ..
  130. RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
  131. RUN mv mirror php-5.6.30.tar.bz2
  132. RUN tar -xvf php-5.6.30.tar.bz2
  133. RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
  134. make && make install && cd ..
  135. RUN cd php-5.6.30 && make clean && ./configure --prefix=/usr/local/php-5.6 && \
  136. make && make install && cd ..
  137. RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
  138. RUN mv mirror php-7.0.18.tar.bz2
  139. RUN tar -xvf php-7.0.18.tar.bz2
  140. RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
  141. make && make install && cd ..
  142. RUN cd php-7.0.18 && make clean && ./configure --prefix=/usr/local/php-7.0 && \
  143. make && make install && cd ..
  144. RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  145. RUN php composer-setup.php
  146. RUN mv composer.phar /usr/bin/composer
  147. RUN php -r "unlink('composer-setup.php');"
  148. RUN composer config -g -- disable-tls true
  149. RUN composer config -g -- secure-http false
  150. RUN cd /tmp && \
  151. rm -rf protobuf && \
  152. git clone https://github.com/google/protobuf.git && \
  153. cd protobuf && \
  154. git reset --hard 6b27c1f981a9a93918e4039f236ead27165a8e91 && \
  155. cd php && \
  156. ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
  157. ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
  158. ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
  159. composer install && \
  160. mv vendor /usr/local/vendor-5.5 && \
  161. ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
  162. ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
  163. ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
  164. composer install && \
  165. mv vendor /usr/local/vendor-5.6 && \
  166. ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
  167. ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
  168. ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
  169. composer install && \
  170. mv vendor /usr/local/vendor-7.0
  171. ##################
  172. # Go dependencies.
  173. RUN apt-get install -y \
  174. # -- For go -- \
  175. golang
  176. ##################
  177. # Javascript dependencies.
  178. RUN apt-get install -y \
  179. # -- For javascript -- \
  180. npm
  181. # On Debian/Ubuntu, nodejs binary is named 'nodejs' because the name 'node'
  182. # is taken by another legacy binary. We don't have that legacy binary and
  183. # npm expects the binary to be named 'node', so we just create a symbol
  184. # link here.
  185. RUN ln -s `which nodejs` /usr/bin/node
  186. ##################
  187. # Prepare ccache
  188. RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
  189. RUN ln -s /usr/bin/ccache /usr/local/bin/g++
  190. RUN ln -s /usr/bin/ccache /usr/local/bin/cc
  191. RUN ln -s /usr/bin/ccache /usr/local/bin/c++
  192. RUN ln -s /usr/bin/ccache /usr/local/bin/clang
  193. RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
  194. # Define the default command.
  195. CMD ["bash"]