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