-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdockerfile-template
195 lines (165 loc) · 4.17 KB
/
dockerfile-template
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
FROM php:<?php echo $release; ?>-fpm-bullseye as php-bullseye-build
ARG WITH_TENSOR=0
ARG WITH_SWOOLE=0
RUN apt-get update;
#apt-get dist-upgrade -y --no-install-recommends -o Dpkg::Options::="--force-confold";
# MYSQL
RUN docker-php-ext-install pdo pdo_mysql mysqli;
# BC MATH
RUN docker-php-ext-install bcmath;
# PCNTL
RUN docker-php-ext-install pcntl;
# OPCACHE
RUN docker-php-ext-enable opcache;
# SYSV MESSAGES
RUN docker-php-ext-install sysvmsg;
# SYSV SEMAPHORE
RUN docker-php-ext-install sysvsem;
# SYSV SHARED MEM
RUN docker-php-ext-install sysvshm;
# GD
<?php if ($majorVersion == '7.3'): ?>
RUN set -eux; \
apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev \
&& \
docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/freetype2 \
--with-png-dir=/usr/include \
--with-jpeg-dir=/usr/include \
&& \
docker-php-ext-install gd;
<?php else: ?>
RUN set -eux; \
apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev libwebp-dev \
&& \
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
&& \
docker-php-ext-install gd;
<?php endif; ?>
# PGSQL
RUN set -eux; \
apt-get install -y libpq-dev; \
docker-php-ext-install pdo_pgsql
# MEMCACHE
RUN set -eux \
&& { \
apt-get install -y libmemcached-dev; \
pecl install igbinary && \
pecl install --nobuild memcached && \
cd "$(pecl config-get temp_dir)/memcached" && \
phpize && \
./configure --enable-memcached-igbinary && \
make -j$(nproc) && \
make install; \
docker-php-ext-enable igbinary memcached; \
}
# INTL
RUN set -ex \
&& { \
apt-get install -y zlib1g-dev libicu-dev; \
docker-php-ext-configure intl; \
docker-php-ext-install intl; \
}
# XDEBUG
RUN set -ex && \
{ \
pecl install xdebug; \
}
# XML
RUN set -ex \
&& { \
apt-get install -y libxml2-dev; \
docker-php-ext-install soap; \
}
# ZIP
<?php if ($majorVersion == '7.3'): ?>
RUN set -ex \
&& { \
apt-get install -y libzip-dev libzip4; \
docker-php-ext-configure zip --with-zlib-dir=/usr; \
docker-php-ext-install zip; \
}
<?php else: ?>
RUN set -ex \
&& { \
apt-get install -y libzip-dev libzip4; \
docker-php-ext-configure zip; \
docker-php-ext-install zip; \
}
<?php endif; ?>
# SSH
RUN set -ex \
&& { \
apt-get install -y libssl-dev libssh2-1-dev git; \
pecl install ssh2-1.3.1; \
docker-php-ext-enable ssh2; \
}
# LIBSODIUM
<?php if (version_compare($majorVersion, '8.1') >= 0): ?>
<?php else: ?>
RUN set -ex \
&& { \
apt-get install -y libsodium-dev libsodium23; \
pecl install libsodium; \
docker-php-ext-enable sodium; \
}
<?php endif; ?>
# TIMEZONEDB
RUN set -ex && \
{ \
pecl install timezonedb; \
docker-php-ext-enable timezonedb; \
}
# REDIS
RUN set -eux \
&& { \
pecl install redis; \
docker-php-ext-enable redis; \
}
<?php if (version_compare($majorVersion, '7.3') > 0): ?>
# FFI
RUN set -eux \
&& { \
apt-get install -y libffi-dev && \
docker-php-ext-configure ffi --with-ffi && \
docker-php-ext-install ffi; \
}
<?php endif; ?>
# TENSOR
RUN set -ex \
&& if [ "$WITH_TENSOR" -ne "0" ] ; then \
apt-get update ; \
apt-get install -y libopenblas-dev liblapacke-dev re2c gfortran; \
pecl install tensor; \
docker-php-ext-enable tensor; \
fi
# SWOOLE
RUN set -ex \
&& if [ "$WITH_SWOOLE" -ne "0" ] ; then \
pecl install openswoole; \
fi
FROM debian:bullseye-slim
COPY --from=php-bullseye-build \
/usr/local/ /usr/local/
COPY platform /platform
ENV WITH_TENSOR=${WITH_TENSOR:-0}
RUN /platform/build-deps.sh
RUN /platform/build-configs.sh
RUN /platform/install-bin.sh
# TENSOR
RUN set -ex \
&& if [ "$WITH_TENSOR" -ne "0" ] ; then \
install_clean libopenblas0 liblapacke; \
fi
COPY platform/runit-services /platform/services/
COPY platform/start-container /usr/local/bin/start-container
RUN chown www-data /var/www;
ENV SVDIR "/platform/services/"
ENV SVWAIT "60"
WORKDIR /app
EXPOSE 8080/tcp
EXPOSE 9000/tcp
ENTRYPOINT ["/usr/local/bin/start-container"]