|
| 1 | +ARG PHP_VERSION=latest |
| 2 | +FROM php:${PHP_VERSION}-fpm-alpine |
| 3 | + |
| 4 | +RUN set -eux; \ |
| 5 | + apk add --no-cache --virtual .composer-rundeps \ |
| 6 | + bash \ |
| 7 | + coreutils \ |
| 8 | + git \ |
| 9 | + make \ |
| 10 | + mercurial \ |
| 11 | + openssh-client \ |
| 12 | + patch \ |
| 13 | + mysql-client \ |
| 14 | + subversion \ |
| 15 | + tini \ |
| 16 | + unzip \ |
| 17 | + zip |
| 18 | + |
| 19 | +RUN set -eux; \ |
| 20 | + apk add --no-cache --virtual .build-deps \ |
| 21 | + icu-dev \ |
| 22 | + libxml2-dev \ |
| 23 | + libxslt-dev \ |
| 24 | + libzip-dev \ |
| 25 | + mysql-dev \ |
| 26 | + zlib-dev \ |
| 27 | + ; \ |
| 28 | + docker-php-ext-install -j "$(nproc)" \ |
| 29 | + intl \ |
| 30 | + pdo \ |
| 31 | + mysqli \ |
| 32 | + pdo_mysql \ |
| 33 | + soap \ |
| 34 | + xsl \ |
| 35 | + zip \ |
| 36 | + ; \ |
| 37 | + runDeps="$( \ |
| 38 | + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ |
| 39 | + | tr ',' '\n' \ |
| 40 | + | sort -u \ |
| 41 | + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ |
| 42 | + )"; \ |
| 43 | + apk add --no-cache --virtual .composer-phpext-rundeps $runDeps; \ |
| 44 | + apk del .build-deps |
| 45 | + |
| 46 | +RUN printf "# composer php cli ini settings\n\ |
| 47 | +date.timezone=UTC\n\ |
| 48 | +memory_limit=-1\n\ |
| 49 | +" > $PHP_INI_DIR/php-cli.ini |
| 50 | + |
| 51 | +ENV COMPOSER_ALLOW_SUPERUSER 1 |
| 52 | +ENV COMPOSER_HOME /tmp |
| 53 | +ENV COMPOSER_VERSION 2.4.4 |
| 54 | +ENV COMPOSER_INSTALLER_URL https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer |
| 55 | +ENV COMPOSER_INSTALLER_HASH 48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5 |
| 56 | + |
| 57 | +RUN set -eux; \ |
| 58 | + curl --silent --fail --location --retry 3 --output /tmp/installer.php --url ${COMPOSER_INSTALLER_URL}; \ |
| 59 | + php -r " \ |
| 60 | + \$signature = '${COMPOSER_INSTALLER_HASH}'; \ |
| 61 | + \$hash = hash('sha384', file_get_contents('/tmp/installer.php')); \ |
| 62 | + if (!hash_equals(\$signature, \$hash)) { \ |
| 63 | + unlink('/tmp/installer.php'); \ |
| 64 | + echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \ |
| 65 | + exit(1); \ |
| 66 | + }"; \ |
| 67 | + php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION}; \ |
| 68 | + composer --ansi --version --no-interaction; \ |
| 69 | + rm -f /tmp/installer.php; \ |
| 70 | + find /tmp -type d -exec chmod -v 1777 {} + |
| 71 | + |
| 72 | +# install phpunit |
| 73 | +RUN wget https://phar.phpunit.de/phpunit-6.1.phar && \ |
| 74 | + chmod +x phpunit-6.1.phar && \ |
| 75 | + mv phpunit-6.1.phar /usr/local/bin/phpunit |
| 76 | + |
| 77 | +WORKDIR /usr/src/symfony |
| 78 | +ENV PS1="\u@\h:\w\\$ " |
0 commit comments