Dockerfile 4.82 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
# This Dockerfile specifies the recipe for creating an image for the tests
# to run in.
#
# We install as many test dependencies here as we can, because these setup
# steps can be cached.  They do *not* run every time we run the build.
# The Docker image is only rebuilt when the Dockerfile (ie. this file)
# changes.

# Base Dockerfile for gRPC dev images
FROM 32bit/debian:latest

# Apt source for php
RUN echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu trusty main" | tee /etc/apt/sources.list.d/various-php.list && \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F4FCBB07

# Install dependencies.  We start with the basic ones require to build protoc
# and the C++ build
RUN apt-get clean && apt-get update && apt-get install -y --force-yes \
  autoconf \
  autotools-dev \
  build-essential \
  bzip2 \
  ccache \
  curl \
  gcc \
  git \
  libc6 \
  libc6-dbg \
  libc6-dev \
  libgtest-dev \
  libtool \
  make \
  parallel \
  time \
  wget \
  unzip \
  # -- For python --
  python-setuptools \
  python-pip \
  python-dev \
  # -- For C++ benchmarks --
  cmake  \
  # -- For PHP --
  php5.5     \
  php5.5-dev \
  php5.5-xml \
  php5.6     \
  php5.6-dev \
  php5.6-xml \
  php7.0     \
  php7.0-dev \
  php7.0-xml \
  phpunit    \
  valgrind   \
  libxml2-dev \
  && apt-get clean

##################
# PHP dependencies.
RUN wget http://am1.php.net/get/php-5.5.38.tar.bz2/from/this/mirror
RUN mv mirror php-5.5.38.tar.bz2
RUN tar -xvf php-5.5.38.tar.bz2
RUN cd php-5.5.38 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.5-zts && \
64
    make && make install && make clean && cd ..
65
RUN cd php-5.5.38 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.5 && \
66
    make && make install && make clean && cd ..
67

68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
RUN wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror
RUN mv mirror php-5.6.30.tar.bz2
RUN tar -xvf php-5.6.30.tar.bz2
RUN cd php-5.6.30 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-5.6-zts && \
    make && make install && cd ..
RUN cd php-5.6.30 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-5.6 && \
    make && make install && cd ..

RUN wget http://am1.php.net/get/php-7.0.18.tar.bz2/from/this/mirror
RUN mv mirror php-7.0.18.tar.bz2
RUN tar -xvf php-7.0.18.tar.bz2
RUN cd php-7.0.18 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.0-zts && \
    make && make install && cd ..
RUN cd php-7.0.18 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.0 && \
    make && make install && cd ..

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
RUN wget http://am1.php.net/get/php-7.1.4.tar.bz2/from/this/mirror
RUN mv mirror php-7.1.4.tar.bz2
RUN tar -xvf php-7.1.4.tar.bz2
RUN cd php-7.1.4 && ./configure --enable-maintainer-zts --prefix=/usr/local/php-7.1-zts && \
    make && make install && cd ..
RUN cd php-7.1.4 && make clean && ./configure --enable-bcmath --prefix=/usr/local/php-7.1 && \
    make && make install && cd ..

RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php
RUN mv composer.phar /usr/bin/composer
RUN php -r "unlink('composer-setup.php');"
RUN composer config -g -- disable-tls true
RUN composer config -g -- secure-http false
RUN cd /tmp && \
  git clone https://github.com/google/protobuf.git && \
  cd protobuf/php && \
  git reset --hard 6b27c1f981a9a93918e4039f236ead27165a8e91 && \
  ln -sfn /usr/local/php-5.5/bin/php /usr/bin/php && \
  ln -sfn /usr/local/php-5.5/bin/php-config /usr/bin/php-config && \
  ln -sfn /usr/local/php-5.5/bin/phpize /usr/bin/phpize && \
  composer install && \
  mv vendor /usr/local/vendor-5.5 && \
  ln -sfn /usr/local/php-5.6/bin/php /usr/bin/php && \
  ln -sfn /usr/local/php-5.6/bin/php-config /usr/bin/php-config && \
  ln -sfn /usr/local/php-5.6/bin/phpize /usr/bin/phpize && \
  composer install && \
  mv vendor /usr/local/vendor-5.6 && \
  ln -sfn /usr/local/php-7.0/bin/php /usr/bin/php && \
  ln -sfn /usr/local/php-7.0/bin/php-config /usr/bin/php-config && \
  ln -sfn /usr/local/php-7.0/bin/phpize /usr/bin/phpize && \
  composer install && \
  mv vendor /usr/local/vendor-7.0 && \
  ln -sfn /usr/local/php-7.1/bin/php /usr/bin/php && \
  ln -sfn /usr/local/php-7.1/bin/php-config /usr/bin/php-config && \
  ln -sfn /usr/local/php-7.1/bin/phpize /usr/bin/phpize && \
  composer install && \
  mv vendor /usr/local/vendor-7.1

123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
##################
# Python dependencies

# These packages exist in apt-get, but their versions are too old, so we have
# to get updates from pip.

RUN pip install pip --upgrade
RUN pip install virtualenv tox yattag

##################
# Prepare ccache

RUN ln -s /usr/bin/ccache /usr/local/bin/gcc
RUN ln -s /usr/bin/ccache /usr/local/bin/g++
RUN ln -s /usr/bin/ccache /usr/local/bin/cc
RUN ln -s /usr/bin/ccache /usr/local/bin/c++
RUN ln -s /usr/bin/ccache /usr/local/bin/clang
RUN ln -s /usr/bin/ccache /usr/local/bin/clang++

# Define the default command.
CMD ["bash"]