|
1 | 1 | # https://hub.docker.com/_/php/tags?name=-fpm-alpine
|
2 |
| -FROM php:8.4.2-fpm-alpine |
| 2 | +FROM php:8.4.2-fpm-alpine AS prod |
3 | 3 |
|
4 | 4 | RUN \
|
5 |
| - apk add icu icu-dev jemalloc libxslt libxslt-dev libffi libffi-dev libpq libpq-dev gmp gmp-dev \ |
6 |
| - && docker-php-ext-install opcache \ |
7 |
| - # Number formatting in our own application templates requires intl. |
8 |
| - intl \ |
9 |
| - # symfony/messenger requires PCNTL for graceful shutdown of queue workers. |
10 |
| - pcntl \ |
11 |
| - # Pheanstalk requires sockets extension otherwise it throws SocketException with "Unknown error" (CLUB-250-B6). |
12 |
| - sockets \ |
13 |
| - # lorenzo/pinky requires XSL extension. |
14 |
| - xsl \ |
15 |
| - # amphp/hpack can benefit from FFI extension. |
16 |
| - ffi \ |
17 |
| - # amphp/postgres requires either pecl-pq or ext-pgsql. |
18 |
| - pgsql \ |
19 |
| - # Phinx requires pdo_pgsql extension. |
20 |
| - pdo_pgsql \ |
21 |
| - # xpaw/steamid requires GMP extension. |
22 |
| - gmp \ |
23 |
| - # All dev packages can be removed post-compile, however the main packages cannot. |
24 |
| - && apk del icu-dev libxslt-dev libffi-dev libpq-dev gmp-dev |
| 5 | + apk add icu icu-dev jemalloc libxslt libxslt-dev libffi libffi-dev libpq libpq-dev gmp gmp-dev \ |
| 6 | + && docker-php-ext-install opcache \ |
| 7 | + # Number formatting in our own application templates requires intl. |
| 8 | + intl \ |
| 9 | + # symfony/messenger requires PCNTL for graceful shutdown of queue workers. |
| 10 | + pcntl \ |
| 11 | + # Pheanstalk requires sockets extension otherwise it throws SocketException with "Unknown error" (CLUB-250-B6). |
| 12 | + sockets \ |
| 13 | + # lorenzo/pinky requires XSL extension. |
| 14 | + xsl \ |
| 15 | + # amphp/hpack can benefit from FFI extension. |
| 16 | + ffi \ |
| 17 | + # amphp/postgres requires either pecl-pq or ext-pgsql. |
| 18 | + pgsql \ |
| 19 | + # Phinx requires pdo_pgsql extension. |
| 20 | + pdo_pgsql \ |
| 21 | + # xpaw/steamid requires GMP extension. |
| 22 | + gmp \ |
| 23 | + # All dev packages can be removed post-compile, however the main packages cannot. |
| 24 | + && apk del icu-dev libxslt-dev libffi-dev libpq-dev gmp-dev |
25 | 25 |
|
26 | 26 | # Replace the slow musl allocator.
|
27 | 27 | ENV LD_PRELOAD=libjemalloc.so.2
|
28 | 28 |
|
29 | 29 | RUN \
|
30 |
| - # Validate jemalloc preloaded. |
31 |
| - ldd `which php` | grep libjemalloc.so.2 && \ |
32 |
| - # Install Composer. |
33 |
| - wget https://raw.githubusercontent.com/composer/getcomposer.org/main/web/installer -qO- |\ |
34 |
| - php -- --install-dir /usr/local/bin --filename composer |
| 30 | + # Validate jemalloc preloaded. |
| 31 | + ldd `which php` | grep libjemalloc.so.2 && \ |
| 32 | + # Install Composer. |
| 33 | + wget https://raw.githubusercontent.com/composer/getcomposer.org/main/web/installer -qO- |\ |
| 34 | + php -- --install-dir /usr/local/bin --filename composer |
| 35 | + |
| 36 | +FROM prod AS dev |
| 37 | + |
| 38 | +RUN \ |
| 39 | + apk add autoconf gcc libc-dev linux-headers make \ |
| 40 | + && pecl install xdebug \ |
| 41 | + && docker-php-ext-enable xdebug \ |
| 42 | + && apk del autoconf gcc libc-dev linux-headers make |
| 43 | + |
| 44 | +RUN <<-'.' |
| 45 | + >>/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini echo -n ' |
| 46 | + xdebug.mode=debug |
| 47 | + xdebug.client_host=host.docker.internal |
| 48 | + ' |
| 49 | +. |
0 commit comments