Dockerfile 6.5 KB

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