|
| 1 | +FROM debian:jessie |
| 2 | + |
| 3 | +ENV \ |
| 4 | + NGINX_VERSION=1.11.6 \ |
| 5 | + PHP_VERSION=7.0.13 |
| 6 | + |
| 7 | +RUN \ |
| 8 | + # Install tools, required for building |
| 9 | + apt-get update && \ |
| 10 | + apt-get install -y \ |
| 11 | + # In general... |
| 12 | + build-essential \ |
| 13 | + curl \ |
| 14 | + |
| 15 | + # For Nginx |
| 16 | + libssl-dev \ |
| 17 | + libpcre3-dev \ |
| 18 | + |
| 19 | + # For PHP |
| 20 | + bison \ |
| 21 | + libbz2-dev \ |
| 22 | + libcurl4-openssl-dev \ |
| 23 | + libpng12-dev \ |
| 24 | + libpq-dev \ |
| 25 | + libxml2-dev \ |
| 26 | + libxslt1-dev \ |
| 27 | + pkg-config \ |
| 28 | + re2c && \ |
| 29 | + |
| 30 | + # Prepare for building |
| 31 | + mkdir -p /tmp/build |
| 32 | + |
| 33 | +RUN \ |
| 34 | + mkdir -p /tmp/build/nginx/ && \ |
| 35 | + cd /tmp/build/nginx && \ |
| 36 | + |
| 37 | + # Download Nginx |
| 38 | + curl -SLO https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz |
| 39 | + |
| 40 | +RUN \ |
| 41 | + cd /tmp/build/nginx && \ |
| 42 | + # Verify signature |
| 43 | + curl -SLO https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc && \ |
| 44 | + curl -SLO https://nginx.org/keys/nginx_signing.key && \ |
| 45 | + gpg --import nginx_signing.key && \ |
| 46 | + curl -SLO https://nginx.org/keys/aalexeev.key && \ |
| 47 | + gpg --import aalexeev.key && \ |
| 48 | + curl -SLO https://nginx.org/keys/is.key && \ |
| 49 | + gpg --import is.key && \ |
| 50 | + curl -SLO https://nginx.org/keys/mdounin.key && \ |
| 51 | + gpg --import mdounin.key && \ |
| 52 | + curl -SLO https://nginx.org/keys/maxim.key && \ |
| 53 | + gpg --import maxim.key && \ |
| 54 | + curl -SLO https://nginx.org/keys/sb.key && \ |
| 55 | + gpg --import sb.key && \ |
| 56 | + gpg nginx-${NGINX_VERSION}.tar.gz.asc |
| 57 | + |
| 58 | +RUN \ |
| 59 | + cd /tmp/build/nginx && \ |
| 60 | + # Unpack tarball |
| 61 | + tar -xvzf nginx-${NGINX_VERSION}.tar.gz |
| 62 | + |
| 63 | +RUN \ |
| 64 | + cd /tmp/build/nginx/nginx-${NGINX_VERSION} && \ |
| 65 | + # Run configuration |
| 66 | + ./configure \ |
| 67 | + --with-file-aio \ |
| 68 | + --with-http_gunzip_module \ |
| 69 | + --with-http_gzip_static_module \ |
| 70 | + --with-http_realip_module \ |
| 71 | + --with-http_ssl_module \ |
| 72 | + --with-http_v2_module \ |
| 73 | + --with-pcre \ |
| 74 | + --with-threads |
| 75 | + |
| 76 | +RUN \ |
| 77 | + cd /tmp/build/nginx/nginx-${NGINX_VERSION} && \ |
| 78 | + # Start compiling and installing |
| 79 | + make -j$(nproc) build && \ |
| 80 | + make modules && \ |
| 81 | + make install |
| 82 | + |
| 83 | +RUN \ |
| 84 | + mkdir -p /tmp/build/php/ && \ |
| 85 | + cd /tmp/build/php && \ |
| 86 | + |
| 87 | + # Download PHP |
| 88 | + curl -SLo php-${PHP_VERSION}.tar.gz http://ch1.php.net/get/php-${PHP_VERSION}.tar.gz/from/this/mirror |
| 89 | + |
| 90 | +# RUN \ |
| 91 | + # TODO SIG VERIFICATION!!! |
| 92 | + |
| 93 | +RUN \ |
| 94 | + cd /tmp/build/php && \ |
| 95 | + # Unpack tarball |
| 96 | + tar -xvzf php-${PHP_VERSION}.tar.gz |
| 97 | + |
| 98 | +RUN \ |
| 99 | + cd /tmp/build/php/php-${PHP_VERSION} && \ |
| 100 | + # Run configuration |
| 101 | + ./configure \ |
| 102 | + --enable-fpm \ |
| 103 | + --enable-mbregex \ |
| 104 | + --enable-mbstring \ |
| 105 | + --enable-opcache \ |
| 106 | + --enable-sockets \ |
| 107 | + --enable-zip \ |
| 108 | + --with-bz2 \ |
| 109 | + --with-curl \ |
| 110 | + --with-gd \ |
| 111 | + --with-gettext \ |
| 112 | + --with-openssl \ |
| 113 | + --with-pcre-regex \ |
| 114 | + --with-pdo-mysql \ |
| 115 | + --with-pdo-pgsql \ |
| 116 | + --with-xsl \ |
| 117 | + --with-zlib |
| 118 | + |
| 119 | +RUN \ |
| 120 | + cd /tmp/build/php/php-${PHP_VERSION} && \ |
| 121 | + # Compile, test and install. |
| 122 | + make -j$(nproc) build && \ |
| 123 | + make test && \ |
| 124 | + make install |
0 commit comments