-
Notifications
You must be signed in to change notification settings - Fork 114
/
Dockerfile.alpine.twig
44 lines (41 loc) · 2.11 KB
/
Dockerfile.alpine.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM php:{{ php_version }}-cli-alpine{{ alpine_version }}
COPY --from=composer:{{ composer.version }} /usr/bin/composer /usr/bin/
RUN \
set -ex && \
apk update && \
apk add --no-cache libstdc++ libpq && \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS {% if option_curl == true %}curl-dev{% endif %} {% if php_version|slice(0, 2) != '7.' and php_version|slice(0, 3) not in ['8.0', '8.1'] %}linux-headers {% endif %}brotli-dev postgresql-dev openssl-dev pcre-dev pcre2-dev zlib-dev && \
# PHP extension pdo_mysql is included since 4.8.12+ and 5.0.1+.
docker-php-ext-install pdo_mysql && \
{%~ if php_extensions is not empty %}
pecl channel-update pecl.php.net && \
{%~ for name, data in php_extensions %}
{%~ if data.configureoptions is empty %}
pecl install {{ name }}{% if data.version is not empty %}-{{ data.version }}{% endif %} && \
{%~ else %}
pecl install --configureoptions '{{ data.configureoptions }}' {{ name }}{% if data.version is not empty %}-{{ data.version }}{% endif %} && \
{%~ endif %}
{%~ endfor %}
# PHP extension Redis is included since 4.8.12+ and 5.0.1+.
{%~ for name, data in php_extensions %}
{%~ if data.enabled %}
docker-php-ext-enable {{ name }} && \
{%~ endif %}
{%~ endfor %}
{%~ endif %}
docker-php-ext-install sockets && \
docker-php-source extract && \
mkdir /usr/src/php/ext/swoole && \
curl -sfL https://github.com/swoole/swoole-src/archive/{% if swoole_version == "nightly" %}master{% else %}v{{ swoole_version }}{% endif %}.tar.gz -o swoole.tar.gz && \
tar xfz swoole.tar.gz --strip-components=1 -C /usr/src/php/ext/swoole && \
docker-php-ext-configure swoole \
--enable-mysqlnd \
--enable-swoole-pgsql \
--enable-brotli \
--enable-openssl \
--enable-sockets {% if option_curl == true %}--enable-swoole-curl {% endif %}{% if option_json == true %}--enable-swoole-json {% endif %}&& \
docker-php-ext-install -j$(nproc) swoole && \
rm -f swoole.tar.gz && \
docker-php-source delete && \
apk del .build-deps
WORKDIR "/var/www/"