1- FROM php:7-fpm
1+ FROM php:7-fpm-alpine
22
3- COPY . .
3+ RUN apk add --no-cache --virtual .composer-rundeps git subversion openssh-client mercurial tini bash patch make zip unzip coreutils \
4+ && apk add --no-cache --virtual .build-deps zlib-dev libzip-dev \
5+ && docker-php-ext-configure zip --with-libzip \
6+ && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) zip opcache \
7+ && docker-php-ext-install pdo_mysql \
8+ && runDeps="$( \
9+ scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
10+ | tr ',' '\n ' \
11+ | sort -u \
12+ | awk 'system(" [ -e /usr/local/lib/" $1 " ]") == 0 { next } { print " so:" $1 }' \
13+ )" \
14+ && apk add --no-cache --virtual .composer-phpext-rundeps $runDeps \
15+ && apk del .build-deps \
16+ && printf "# composer php cli ini settings\n \
17+ date.timezone=UTC\n \
18+ memory_limit=-1\n \
19+ opcache.enable_cli=1\n \
20+ " > $PHP_INI_DIR/php-cli.ini
21+
22+ ENV COMPOSER_ALLOW_SUPERUSER 1
23+ ENV COMPOSER_HOME /tmp
24+ ENV COMPOSER_VERSION 1.9.0
425
5- RUN docker-php-ext-install pdo_mysql
26+ RUN curl --silent --fail --location --retry 3 --output /tmp/installer.php --url https://raw.githubusercontent.com/composer/getcomposer.org/cb19f2aa3aeaa2006c0cd69a7ef011eb31463067/web/installer \
27+ && php -r " \
28+ \$ signature = '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5'; \
29+ \$ hash = hash('sha384', file_get_contents('/tmp/installer.php')); \
30+ if (!hash_equals(\$ signature, \$ hash)) { \
31+ unlink('/tmp/installer.php'); \
32+ echo 'Integrity check failed, installer is either corrupt or worse.' . PHP_EOL; \
33+ exit(1); \
34+ }" \
35+ && php /tmp/installer.php --no-ansi --install-dir=/usr/bin --filename=composer --version=${COMPOSER_VERSION} \
36+ && composer --ansi --version --no-interaction \
37+ && rm -f /tmp/installer.php \
38+ && find /tmp -type d -exec chmod -v 1777 {} +
39+
40+ COPY . .
641
7- RUN apt-get update && apt-get install -y iputils-ping && apt-get clean all
42+ RUN composer install
0 commit comments