|
| 1 | +FROM gcr.io/gcp-runtimes/ubuntu_16_0_4 |
| 2 | +ENV PHP_DIR=/opt/php74 |
| 3 | +ENV PHP_SRC_DIR=/usr/local/src/php74-build |
| 4 | +ENV PATH=${PATH}:/usr/local/bin:${PHP_DIR}/bin |
| 5 | + |
| 6 | +RUN apt-get update && \ |
| 7 | + apt-get -y install \ |
| 8 | + autoconf \ |
| 9 | + build-essential \ |
| 10 | + git-core \ |
| 11 | + jq \ |
| 12 | + libbz2-dev \ |
| 13 | + libcurl4-openssl-dev \ |
| 14 | + libc-client2007e \ |
| 15 | + libc-client2007e-dev \ |
| 16 | + libfcgi-dev \ |
| 17 | + libfcgi0ldbl \ |
| 18 | + libfreetype6-dev \ |
| 19 | + libicu-dev \ |
| 20 | + libjpeg62-dbg \ |
| 21 | + libjpeg-dev \ |
| 22 | + libkrb5-dev \ |
| 23 | + libmcrypt-dev \ |
| 24 | + libpng12-dev \ |
| 25 | + libpq-dev \ |
| 26 | + libssl-dev \ |
| 27 | + libxml2-dev \ |
| 28 | + libxslt1-dev \ |
| 29 | + libzip-dev \ |
| 30 | + python-ipaddr \ |
| 31 | + wget \ |
| 32 | + zip \ |
| 33 | + zlib1g-dev \ |
| 34 | + pkg-config \ |
| 35 | + sqlite3 \ |
| 36 | + libsqlite3-dev \ |
| 37 | + libonig-dev \ |
| 38 | + php-pear |
| 39 | + |
| 40 | +RUN ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a && \ |
| 41 | + mkdir -p ${PHP_DIR} ${PHP_SRC_DIR} ${PHP_DIR}/lib/conf.d && \ |
| 42 | + cd ${PHP_SRC_DIR} && \ |
| 43 | + wget http://us1.php.net/get/php-7.4.0.tar.bz2/from/this/mirror \ |
| 44 | + -O php-7.4.0.tar.bz2 && \ |
| 45 | + tar jxf php-7.4.0.tar.bz2 && \ |
| 46 | + cd php-7.4.0 && \ |
| 47 | + ./configure \ |
| 48 | + --prefix=${PHP_DIR} \ |
| 49 | + --with-config-file-scan-dir=${PHP_DIR}/lib/conf.d \ |
| 50 | + --with-pdo-pgsql \ |
| 51 | + --with-zlib-dir \ |
| 52 | + --with-freetype-dir \ |
| 53 | + --enable-mbstring \ |
| 54 | + --with-libxml-dir=/usr \ |
| 55 | + --enable-soap \ |
| 56 | + --enable-intl \ |
| 57 | + --enable-calendar \ |
| 58 | + --with-curl \ |
| 59 | + --with-mcrypt \ |
| 60 | + --with-zlib \ |
| 61 | + --with-gd \ |
| 62 | + --with-pgsql \ |
| 63 | + --disable-rpath \ |
| 64 | + --enable-inline-optimization \ |
| 65 | + --with-bz2 \ |
| 66 | + --with-zlib \ |
| 67 | + --enable-sockets \ |
| 68 | + --enable-sysvsem \ |
| 69 | + --enable-sysvshm \ |
| 70 | + --enable-sysvmsg \ |
| 71 | + --enable-pcntl \ |
| 72 | + --enable-mbregex \ |
| 73 | + --enable-exif \ |
| 74 | + --enable-bcmath \ |
| 75 | + --with-mhash \ |
| 76 | + --enable-zip \ |
| 77 | + --with-pcre-regex \ |
| 78 | + --with-mysql \ |
| 79 | + --with-pdo-mysql \ |
| 80 | + --with-mysqli \ |
| 81 | + --with-jpeg-dir=/usr \ |
| 82 | + --with-png-dir=/usr \ |
| 83 | + --enable-gd-native-ttf \ |
| 84 | + --with-openssl \ |
| 85 | + --with-fpm-user=www-data \ |
| 86 | + --with-fpm-group=www-data \ |
| 87 | + --with-libdir=/lib/x86_64-linux-gnu \ |
| 88 | + --enable-ftp \ |
| 89 | + --with-imap \ |
| 90 | + --with-imap-ssl \ |
| 91 | + --with-gettext \ |
| 92 | + --with-xmlrpc \ |
| 93 | + --with-xsl \ |
| 94 | + --with-zip \ |
| 95 | + --with-kerberos \ |
| 96 | + --enable-fpm && \ |
| 97 | + make && \ |
| 98 | + make install && \ |
| 99 | + pecl install grpc && \ |
| 100 | + cp php.ini-production ${PHP_DIR}/lib/php.ini && \ |
| 101 | + echo 'zend_extension=opcache.so' >> ${PHP_DIR}/lib/php.ini && \ |
| 102 | + echo 'extension=grpc.so' >> ${PHP_DIR}/lib/conf.d/ext-grpc.ini && \ |
| 103 | + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ |
| 104 | + php -r "if (hash_file('SHA384', 'composer-setup.php') === rtrim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \ |
| 105 | + php composer-setup.php --filename=composer --install-dir=/usr/local/bin |
| 106 | + |
| 107 | +# Remove old version of PHP |
| 108 | +RUN apt purge -y php7.0-common |
| 109 | + |
| 110 | +# Install phpunit globally |
| 111 | +RUN composer global require phpunit/phpunit:^7.0 |
| 112 | + |
| 113 | +# Install Google Cloud SDK |
| 114 | +RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz \ |
| 115 | + -o ${HOME}/google-cloud-sdk.tar.gz \ |
| 116 | + && tar xzf ${HOME}/google-cloud-sdk.tar.gz -C $HOME \ |
| 117 | + && ${HOME}/google-cloud-sdk/install.sh \ |
| 118 | + --usage-reporting false \ |
| 119 | + --path-update false \ |
| 120 | + --command-completion false |
| 121 | + |
| 122 | +# Make composer and gcloud bins available via the PATH variable |
| 123 | +ENV PATH="$PATH:/root/.composer/vendor/bin:/root/google-cloud-sdk/bin" |
| 124 | + |
| 125 | +# Configure Google Cloud SDK |
| 126 | +RUN gcloud config set app/promote_by_default false && \ |
| 127 | + gcloud config set disable_prompts true && \ |
| 128 | + gcloud -q components install app-engine-python && \ |
| 129 | + gcloud -q components update |
| 130 | + |
| 131 | +# Build php-cs-fixer |
| 132 | +RUN composer global require friendsofphp/php-cs-fixer |
0 commit comments