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