-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
244 lines (213 loc) · 7.58 KB
/
Dockerfile
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
ARG BASEIMAGE="php:8.3.13-cli-alpine3.20"
FROM $BASEIMAGE as compile
ENV PHP_REDIS_VERSION="6.1.0" \
PHP_MONGODB_VERSION="1.20.0" \
PHP_SWOOLE_VERSION="v5.1.5" \
PHP_IMAGICK_VERSION="3.7.0" \
PHP_YAML_VERSION="2.2.4" \
PHP_MAXMINDDB_VERSION="v1.11.1" \
PHP_SCRYPT_VERSION="2.0.1" \
PHP_ZSTD_VERSION="0.13.3" \
PHP_BROTLI_VERSION="0.15.0" \
PHP_SNAPPY_VERSION="c27f830dcfe6c41eb2619a374de10fd0597f4939" \
PHP_LZ4_VERSION="2f006c3e4f1fb3a60d2656fc164f9ba26b71e995" \
PHP_XDEBUG_VERSION="3.3.2" \
PHP_OPENTELEMETRY_VERSION="1.1.0" \
PHP_PROTOBUF_VERSION="4.28.3"
RUN \
apk add --no-cache --virtual .deps \
linux-headers \
make \
automake \
autoconf \
gcc \
g++ \
git \
zlib-dev \
openssl-dev \
yaml-dev \
imagemagick \
imagemagick-dev \
libjpeg-turbo-dev \
jpeg-dev \
zlib-dev \
libpng-dev \
libjxl-dev \
libmaxminddb-dev \
zstd-dev \
brotli-dev \
lz4-dev \
curl-dev
RUN docker-php-ext-install sockets
FROM compile AS redis
RUN \
# Redis Extension
git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git && \
cd phpredis && \
phpize && \
./configure && \
make && make install
## Swoole Extension
FROM compile AS swoole
RUN \
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git && \
cd swoole-src && \
phpize && \
./configure --enable-sockets --enable-http2 --enable-openssl --enable-swoole-curl && \
make && make install && \
cd ..
## Imagick Extension
FROM compile AS imagick
RUN \
git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/imagick/imagick && \
cd imagick && \
phpize && \
./configure && \
make && make install
## YAML Extension
FROM compile AS yaml
RUN \
git clone --depth 1 --branch $PHP_YAML_VERSION https://github.com/php/pecl-file_formats-yaml && \
cd pecl-file_formats-yaml && \
phpize && \
./configure && \
make && make install
## Maxminddb extension
FROM compile AS maxmind
RUN \
git clone --depth 1 --branch $PHP_MAXMINDDB_VERSION https://github.com/maxmind/MaxMind-DB-Reader-php.git && \
cd MaxMind-DB-Reader-php && \
cd ext && \
phpize && \
./configure && \
make && make install
# Mongodb Extension
FROM compile as mongodb
RUN \
git clone --depth 1 --branch $PHP_MONGODB_VERSION https://github.com/mongodb/mongo-php-driver.git && \
cd mongo-php-driver && \
git submodule update --init && \
phpize && \
./configure && \
make && make install
# Zstd Compression
FROM compile as zstd
RUN git clone --recursive -n https://github.com/kjdev/php-ext-zstd.git \
&& cd php-ext-zstd \
&& git checkout $PHP_ZSTD_VERSION \
&& phpize \
&& ./configure --with-libzstd \
&& make && make install
## Brotli Extension
FROM compile as brotli
RUN git clone https://github.com/kjdev/php-ext-brotli.git \
&& cd php-ext-brotli \
&& git reset --hard $PHP_BROTLI_VERSION \
&& phpize \
&& ./configure --with-libbrotli \
&& make && make install
## LZ4 Extension
FROM compile AS lz4
RUN git clone --recursive https://github.com/kjdev/php-ext-lz4.git \
&& cd php-ext-lz4 \
&& git reset --hard $PHP_LZ4_VERSION \
&& phpize \
&& ./configure --with-lz4-includedir=/usr \
&& make && make install
## Snappy Extension
FROM compile AS snappy
RUN git clone --recursive https://github.com/kjdev/php-ext-snappy.git \
&& cd php-ext-snappy \
&& git reset --hard $PHP_SNAPPY_VERSION \
&& phpize \
&& ./configure \
&& make && make install
## Scrypt Extension
FROM compile AS scrypt
RUN git clone --depth 1 https://github.com/DomBlack/php-scrypt.git \
&& cd php-scrypt \
&& git reset --hard $PHP_SCRYPT_VERSION \
&& phpize \
&& ./configure --enable-scrypt \
&& make && make install
## XDebug Extension
FROM compile AS xdebug
RUN \
git clone --depth 1 --branch $PHP_XDEBUG_VERSION https://github.com/xdebug/xdebug && \
cd xdebug && \
phpize && \
./configure && \
make && make install
FROM compile AS opentelemetry
RUN pecl install opentelemetry-${PHP_OPENTELEMETRY_VERSION}
FROM compile AS protobuf
RUN pecl install protobuf-${PHP_PROTOBUF_VERSION}
FROM compile AS gd
RUN docker-php-ext-install gd
FROM $BASEIMAGE as final
LABEL maintainer="[email protected]"
ENV DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
ENV DOCKER_COMPOSE_VERSION="v2.29.5"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN set -ex \
&& apk --no-cache add \
postgresql-dev
RUN \
apk update \
&& apk add --no-cache --virtual .deps \
linux-headers \
make \
automake \
autoconf \
gcc \
g++ \
curl-dev \
&& apk add --no-cache \
libstdc++ \
rsync \
brotli-dev \
lz4-dev \
yaml-dev \
imagemagick \
imagemagick-dev \
libjpeg-turbo-dev \
jpeg-dev \
libjxl-dev \
libavif \
libheif \
imagemagick-heic \
zlib-dev \
libpng-dev \
libmaxminddb-dev \
certbot \
docker-cli \
libgomp \
git \
&& docker-php-ext-install sockets pdo_mysql pdo_pgsql intl \
&& apk del .deps \
&& rm -rf /var/cache/apk/*
RUN \
mkdir -p $DOCKER_CONFIG/cli-plugins \
&& ARCH=$(uname -m) && if [ $ARCH == "armv7l" ]; then ARCH="armv7"; fi \
&& curl -SL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-$ARCH -o $DOCKER_CONFIG/cli-plugins/docker-compose \
&& chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
WORKDIR /usr/src/code
COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20230831/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20230831/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=imagick /usr/local/lib/php/extensions/no-debug-non-zts-20230831/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=yaml /usr/local/lib/php/extensions/no-debug-non-zts-20230831/yaml.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=maxmind /usr/local/lib/php/extensions/no-debug-non-zts-20230831/maxminddb.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20230831/mongodb.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=scrypt /usr/local/lib/php/extensions/no-debug-non-zts-20230831/scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=zstd /usr/local/lib/php/extensions/no-debug-non-zts-20230831/zstd.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=brotli /usr/local/lib/php/extensions/no-debug-non-zts-20230831/brotli.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=lz4 /usr/local/lib/php/extensions/no-debug-non-zts-20230831/lz4.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=snappy /usr/local/lib/php/extensions/no-debug-non-zts-20230831/snappy.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=xdebug /usr/local/lib/php/extensions/no-debug-non-zts-20230831/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=opentelemetry /usr/local/lib/php/extensions/no-debug-non-zts-20230831/opentelemetry.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=protobuf /usr/local/lib/php/extensions/no-debug-non-zts-20230831/protobuf.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=gd /usr/local/lib/php/extensions/no-debug-non-zts-20230831/gd.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
# Enable Extensions
RUN docker-php-ext-enable swoole redis imagick yaml maxminddb scrypt zstd brotli lz4 snappy opentelemetry protobuf gd
EXPOSE 80
CMD [ "tail", "-f", "/dev/null" ]