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