-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.8.2-fpm
117 lines (108 loc) · 4.21 KB
/
Dockerfile.8.2-fpm
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
FROM php:8.2-fpm-bullseye
LABEL maintainer="lzh1104 <[email protected]>"
# WORKDIR /var/www/html
# use mirror tsinghua
ARG SWOOLE_VERSION
ARG SWOW_VERSION
ARG USE_SWOW
ENV SWOOLE_V=${SWOOLE_VERSION:-5.1.1}
ENV SWOW_V=${SWOW_VERSION:-1.4.1}
ENV USE_SWOW_E=${USE_SWOW:+swow}
RUN set -eux; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libmagick++-dev \
libssl-dev \
# swoole enable c-ares
libc-ares-dev \
libmcrypt-dev \
libxml2-dev \
libzip-dev \
libmemcached-dev \
libsqlite3-dev \
libavif-dev libgd-dev libpng-dev \
libwebp-dev libjpeg-dev \
libfreetype-dev libcurl4-openssl-dev; \
\
rm -rf /var/lib/apt/lists/*
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y --no-install-recommends tzdata; \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime; \
echo "Asia/Shanghai" > /etc/timezone; \
apt-get install -y --no-install-recommends \
$PHPIZE_DEPS \
# linux-headers \
; \
\
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
cd /tmp && \
wget https://github.com/emcrisostomo/fswatch/releases/download/1.17.1/fswatch-1.17.1.tar.gz \
&& tar -xzvf fswatch-1.17.1.tar.gz \
&& cd fswatch-1.17.1 \
&& ./configure --build="$gnuArch" --prefix=/usr && make && make install \
&& rm /tmp/fswatch-1.17.1 -rf; \
export CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
pecl install redis; \
pecl install apcu; \
pecl install protobuf; \
docker-php-ext-install bcmath \
mysqli pcntl pdo_mysql shmop soap sockets sysvsem opcache zip; \
docker-php-ext-configure gd --with-libdir=/usr/include --with-avif --with-webp --with-jpeg --with-freetype; \
docker-php-ext-install gd; \
pecl install imagick; \
pecl install memcached; \
pecl install mongodb; \
# pecl install xdebug; \
docker-php-ext-enable redis apcu protobuf; \
# https://pecl.php.net/package/imagick
docker-php-ext-enable imagick; \
docker-php-ext-enable memcached mongodb; \
if [ "$USE_SWOW_E" != "swow" ]; then \
pecl install -D 'enable-openssl="yes" enable-http2="yes" enable-mysqlnd="yes" enable-swoole-json="yes" enable-swoole-curl="yes" enable-cares="yes" enable-swoole-sqlite="yes"' swoole; \
# cd /tmp && pecl download "swoole-$SWOW_V" && tar xzvf "swoole-$SWOW_V.tgz" && cd "swoole-$SWOW_V" && phpize && ./configure --enable-sockets --enable-openssl --enable-mysqlnd --enable-swoole-json && make && make install; \
docker-php-ext-enable swoole; \
echo "swoole.use_shortname=off" >> /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini; \
else \
# https://github.com/swow/swow
# swow 和 swoole 不能共存
curl -o swow.tar.gz -fL "https://github.com/swow/swow/archive/refs/tags/v$SWOW_V.tar.gz"; \
tar -xzf swow.tar.gz -C /tmp/; \
rm swow.tar.gz; \
cd "/tmp/swow-$SWOW_V/ext" && phpize && ./configure && make && make install; \
docker-php-ext-enable swow; \
fi; \
# Chane TimeZone
cp $PHP_INI_DIR/php.ini-development $PHP_INI_DIR/php.ini; \
# && cp $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini \
sed -i 's/;date.timezone =/date.timezone = "Asia\/Shanghai"/g' $PHP_INI_DIR/php.ini; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
[ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
find /usr/local -type f -executable -exec ldd '{}' ';' \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
\
# update pecl channel definitions https://github.com/docker-library/php/issues/443
pecl update-channels; \
rm -rf /tmp/pear ~/.pearrc; \
\
rm /tmp/* -rf
# install composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer