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 32bit/debian:latest
11
12# Apt source for php
13RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \
14  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07
15
16# Install dependencies.  We start with the basic ones require to build protoc
17# and the C++ build
18RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
19  autoconf \
20  autotools-dev \
21  build-essential \
22  bzip2 \
23  ccache \
24  curl \
25  gcc \
26  git \
27  libc6 \
28  libc6-dbg \
29  libc6-dev \
30  libgtest-dev \
31  libtool \
32  make \
33  parallel \
34  time \
35  wget \
36  unzip \
37  # -- For python --
38  python-setuptools \
39  python-pip \
40  python-dev \
41  # -- For C++ benchmarks --
42  cmake  \
43  # -- For PHP --
44  php5.5     \
45  php5.5-dev \
46  php5.5-xml \
47  php5.6     \
48  php5.6-dev \
49  php5.6-xml \
50  php7.0     \
51  php7.0-dev \
52  php7.0-xml \
53  phpunit    \
54  valgrind   \
55  libxml2-dev \
56  && apt-get clean
57
58##################
59# PHP dependencies.
60RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
61RUN mv mirror php-5.5.38.tar.bz2
62RUN tar -xvf php-5.5.38.tar.bz2
63RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
64    make && make install && make clean && cd ..
65RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
66    make && make install && make clean && cd ..
67
68RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
69RUN mv mirror php-5.6.30.tar.bz2
70RUN tar -xvf php-5.6.30.tar.bz2
71RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
72    make && make install && cd ..
73RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
74    make && make install && cd ..
75
76RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
77RUN mv mirror php-7.0.18.tar.bz2
78RUN tar -xvf php-7.0.18.tar.bz2
79RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
80    make && make install && cd ..
81RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
82    make && make install && cd ..
83
84RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
85RUN mv mirror php-7.1.4.tar.bz2
86RUN tar -xvf php-7.1.4.tar.bz2
87RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \
88    make && make install && cd ..
89RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \
90    make && make install && cd ..
91
92RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
93RUN php composer-setup.php
94RUN mv composer.phar /usr/bin/composer
95RUN php -r "unlink('composer-setup.php');"
96RUN composer config -g -- disable-tls true
97RUN composer config -g -- secure-http false
98RUN cd /tmp && \
99  git clone https://github.com/google/protobuf.git && \
100  cd protobuf/php && \
101  git reset --hard 49b44bff2b6257a119f9c6a342d6151c736586b8 && \
102  ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
103  ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
104  ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
105  composer install && \
106  mv vendor /usr/local/vendor-5.5 && \
107  ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
108  ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
109  ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
110  composer install && \
111  mv vendor /usr/local/vendor-5.6 && \
112  ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
113  ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
114  ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
115  composer install && \
116  mv vendor /usr/local/vendor-7.0 && \
117  ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \
118  ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \
119  ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \
120  composer install && \
121  mv vendor /usr/local/vendor-7.1
122
123##################
124# Python dependencies
125
126# These packages exist in apt-get, but their versions are too old, so we have
127# to get updates from pip.
128
129RUN pip install pip --upgrade
130RUN pip install virtualenv tox yattag
131
132##################
133# Prepare ccache
134
135RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
136RUN ln -s /usr/bin/ccache /usr/local/bin/g++
137RUN ln -s /usr/bin/ccache /usr/local/bin/cc
138RUN ln -s /usr/bin/ccache /usr/local/bin/c++
139RUN ln -s /usr/bin/ccache /usr/local/bin/clang
140RUN ln -s /usr/bin/ccache /usr/local/bin/clang++
141
142# Define the default command.
143CMD ["bash"]
144