|
| 1 | +# |
| 2 | +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" |
| 3 | +# |
| 4 | +# PLEASE DO NOT EDIT IT DIRECTLY. |
| 5 | +# |
| 6 | + |
| 7 | +FROM alpine:3.8 |
| 8 | + |
| 9 | +# dependencies required for running "phpize" |
| 10 | +# these get automatically installed and removed by "docker-php-ext-*" (unless they're already installed) |
| 11 | +ENV PHPIZE_DEPS \ |
| 12 | + autoconf \ |
| 13 | + dpkg-dev dpkg \ |
| 14 | + file \ |
| 15 | + g++ \ |
| 16 | + gcc \ |
| 17 | + libc-dev \ |
| 18 | + make \ |
| 19 | + pkgconf \ |
| 20 | + re2c |
| 21 | + |
| 22 | +# persistent / runtime deps |
| 23 | +RUN apk add --no-cache --virtual .persistent-deps \ |
| 24 | + ca-certificates \ |
| 25 | + curl \ |
| 26 | + tar \ |
| 27 | + xz \ |
| 28 | +# https://github.com/docker-library/php/issues/494 |
| 29 | + libressl |
| 30 | + |
| 31 | +# ensure www-data user exists |
| 32 | +RUN set -x \ |
| 33 | + && addgroup -g 82 -S www-data \ |
| 34 | + && adduser -u 82 -D -S -G www-data www-data |
| 35 | +# 82 is the standard uid/gid for "www-data" in Alpine |
| 36 | +# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 |
| 37 | +# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 |
| 38 | +# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 |
| 39 | + |
| 40 | +ENV PHP_INI_DIR /usr/local/etc/php |
| 41 | +RUN mkdir -p $PHP_INI_DIR/conf.d |
| 42 | + |
| 43 | +##<autogenerated>## |
| 44 | +##</autogenerated>## |
| 45 | + |
| 46 | +# Apply stack smash protection to functions using local buffers and alloca() |
| 47 | +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) |
| 48 | +# Enable optimization (-O2) |
| 49 | +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) |
| 50 | +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) |
| 51 | +# https://github.com/docker-library/php/issues/272 |
| 52 | +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" |
| 53 | +ENV PHP_CPPFLAGS="$PHP_CFLAGS" |
| 54 | +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" |
| 55 | + |
| 56 | +ENV GPG_KEYS 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 |
| 57 | + |
| 58 | +ENV PHP_VERSION 5.6.40 |
| 59 | +ENV PHP_URL="https://secure.php.net/get/php-5.6.40.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-5.6.40.tar.xz.asc/from/this/mirror" |
| 60 | +ENV PHP_SHA256="1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c" PHP_MD5="" |
| 61 | + |
| 62 | +RUN set -xe; \ |
| 63 | + \ |
| 64 | + apk add --no-cache --virtual .fetch-deps \ |
| 65 | + gnupg \ |
| 66 | + wget \ |
| 67 | + ; \ |
| 68 | + \ |
| 69 | + mkdir -p /usr/src; \ |
| 70 | + cd /usr/src; \ |
| 71 | + \ |
| 72 | + wget -O php.tar.xz "$PHP_URL"; \ |
| 73 | + \ |
| 74 | + if [ -n "$PHP_SHA256" ]; then \ |
| 75 | + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ |
| 76 | + fi; \ |
| 77 | + if [ -n "$PHP_MD5" ]; then \ |
| 78 | + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ |
| 79 | + fi; \ |
| 80 | + \ |
| 81 | + if [ -n "$PHP_ASC_URL" ]; then \ |
| 82 | + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ |
| 83 | + export GNUPGHOME="$(mktemp -d)"; \ |
| 84 | + for key in $GPG_KEYS; do \ |
| 85 | + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ |
| 86 | + done; \ |
| 87 | + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ |
| 88 | + command -v gpgconf > /dev/null && gpgconf --kill all; \ |
| 89 | + rm -rf "$GNUPGHOME"; \ |
| 90 | + fi; \ |
| 91 | + \ |
| 92 | + apk del .fetch-deps |
| 93 | + |
| 94 | +COPY docker-php-source /usr/local/bin/ |
| 95 | + |
| 96 | +RUN set -xe \ |
| 97 | + && apk add --no-cache --virtual .build-deps \ |
| 98 | + $PHPIZE_DEPS \ |
| 99 | + coreutils \ |
| 100 | + curl-dev \ |
| 101 | + libedit-dev \ |
| 102 | + libressl-dev \ |
| 103 | + libxml2-dev \ |
| 104 | + sqlite-dev \ |
| 105 | + \ |
| 106 | + && export CFLAGS="$PHP_CFLAGS" \ |
| 107 | + CPPFLAGS="$PHP_CPPFLAGS" \ |
| 108 | + LDFLAGS="$PHP_LDFLAGS" \ |
| 109 | + && docker-php-source extract \ |
| 110 | + && cd /usr/src/php \ |
| 111 | + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ |
| 112 | + && ./configure \ |
| 113 | + --build="$gnuArch" \ |
| 114 | + --with-config-file-path="$PHP_INI_DIR" \ |
| 115 | + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ |
| 116 | + \ |
| 117 | +# make sure invalid --configure-flags are fatal errors intead of just warnings |
| 118 | + --enable-option-checking=fatal \ |
| 119 | + \ |
| 120 | +# https://github.com/docker-library/php/issues/439 |
| 121 | + --with-mhash \ |
| 122 | + \ |
| 123 | +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) |
| 124 | + --enable-ftp \ |
| 125 | +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) |
| 126 | + --enable-mbstring \ |
| 127 | +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) |
| 128 | + --enable-mysqlnd \ |
| 129 | + \ |
| 130 | + --with-curl \ |
| 131 | + --with-libedit \ |
| 132 | + --with-openssl \ |
| 133 | + --with-zlib \ |
| 134 | + \ |
| 135 | +# bundled pcre does not support JIT on s390x |
| 136 | +# https://manpages.debian.org/stretch/libpcre3-dev/pcrejit.3.en.html#AVAILABILITY_OF_JIT_SUPPORT |
| 137 | + $(test "$gnuArch" = 's390x-linux-gnu' && echo '--without-pcre-jit') \ |
| 138 | + \ |
| 139 | + $PHP_EXTRA_CONFIGURE_ARGS \ |
| 140 | + && make -j "$(nproc)" \ |
| 141 | + && make install \ |
| 142 | + && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ |
| 143 | + && make clean \ |
| 144 | + \ |
| 145 | +# https://github.com/docker-library/php/issues/692 (copy default example "php.ini" files somewhere easily discoverable) |
| 146 | + && cp -v php.ini-* "$PHP_INI_DIR/" \ |
| 147 | + \ |
| 148 | + && cd / \ |
| 149 | + && docker-php-source delete \ |
| 150 | + \ |
| 151 | + && runDeps="$( \ |
| 152 | + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ |
| 153 | + | tr ',' '\n' \ |
| 154 | + | sort -u \ |
| 155 | + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ |
| 156 | + )" \ |
| 157 | + && apk add --no-cache --virtual .php-rundeps $runDeps \ |
| 158 | + \ |
| 159 | + && apk del .build-deps \ |
| 160 | + \ |
| 161 | +# https://github.com/docker-library/php/issues/443 |
| 162 | + && pecl update-channels \ |
| 163 | + && rm -rf /tmp/pear ~/.pearrc |
| 164 | + |
| 165 | +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ |
| 166 | + |
| 167 | +ENTRYPOINT ["docker-php-entrypoint"] |
| 168 | +##<autogenerated>## |
| 169 | +CMD ["php", "-a"] |
| 170 | +##</autogenerated>## |
0 commit comments