-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile
207 lines (167 loc) · 5.99 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
ARG PHP_VERSION
FROM php:${PHP_VERSION}-fpm-bullseye
# basic dependencies
RUN apt-get update -yq && \
apt-get install -y --no-install-recommends \
procps \
curl \
libcurl4-gnutls-dev \
libmemcached-dev \
libz-dev \
libpq-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
libssl-dev \
libmcrypt-dev \
bc \
gnupg \
wget \
ca-certificates \
--no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN docker-php-ext-install pdo_pgsql && \
docker-php-ext-install bcmath && \
docker-php-ext-install pcntl && \
docker-php-ext-install curl
# Install the PHP gd library
RUN docker-php-ext-install gd && \
docker-php-ext-configure gd \
--with-jpeg \
--with-freetype && \
docker-php-ext-install gd
# Set Environment Variables
ENV DEBIAN_FRONTEND noninteractive
# always run apt update when start and after add new source list, then clean up at end.
RUN apt-get update -yqq && \
apt-get install -y apt-utils && \
pecl channel-update pecl.php.net
ARG INSTALL_OPCACHE=false
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache \
;fi
# Copy opcache configration
#COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
# not done here, host-mounted upon instantiation
ARG INSTALL_INTL=false
RUN if [ ${INSTALL_INTL} = true ]; then \
# Install intl and requirements
apt-get update -yq && \
apt-get install -y zlib1g-dev libicu-dev g++ && \
docker-php-ext-configure intl && \
docker-php-ext-install intl \
;fi
ARG INSTALL_PGSQL=false
RUN if [ ${INSTALL_PGSQL} = true ]; then \
# Install the pgsql extension
docker-php-ext-install pgsql \
;fi
ARG INSTALL_PG_CLIENT=false
RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \
# Create folders if not exists (https://github.com/tianon/docker-brew-debian/issues/65)
mkdir -p /usr/share/man/man1 && \
mkdir -p /usr/share/man/man7 && \
# Add the PostgreSQL Apt Repository
echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
# Install the pgsql client
apt-get update -yq && \
apt-get install -y postgresql-client-14 && \
apt-get clean \
;fi
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
pecl install xdebug-2.5.5; \
else \
pecl install xdebug-2.9.8; \
fi && \
docker-php-ext-enable xdebug \
;fi
ARG INSTALL_NETCAT_JQ=false
RUN if [ ${INSTALL_NETCAT_JQ} = true ]; then \
# Create folders if not exists (https://github.com/tianon/docker-brew-debian/issues/65)
mkdir -p /usr/share/man/man1 && \
mkdir -p /usr/share/man/man7 && \
# Install netcat-openbsd and jq
apt-get update -yq && \
apt-get install -y netcat-openbsd inetutils-ping jq \
;fi
ARG INSTALL_GRAPHVIZ=false
RUN if [ ${INSTALL_GRAPHVIZ} = true ]; then \
apt-get update -yq && \
apt-get install -y graphviz \
;fi
ARG INSTALL_COMPOSER=false
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_HOME /tmp
RUN if [ ${INSTALL_COMPOSER} = true ]; then \
apt-get update -yq \
&& apt-get install -y libzip-dev unzip wget \
&& docker-php-ext-install zip \
&& EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")" \
&& test $EXPECTED_SIGNATURE = $ACTUAL_SIGNATURE \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet \
&& rm composer-setup.php \
&& composer config --global repo.packagist composer https://packagist.org \
;fi
ARG INSTALL_TIDEWAYS_XHPROF=false
RUN if [ ${INSTALL_TIDEWAYS_XHPROF} = true ]; then \
curl -o tideways-xhprof.tar.gz -s -L https://github.com/tideways/php-xhprof-extension/archive/v4.1.6.tar.gz && \
tar xzvf tideways-xhprof.tar.gz && \
cd php-xhprof-extension* && \
phpize && \
./configure && \
make && \
make install && \
echo "extension=tideways.so" > /usr/local/etc/php/conf.d/tideways_xhprof.ini && \
pecl install mongodb && docker-php-ext-enable mongodb && \
curl -o /usr/local/src/xhgui.tar.gz -s -L https://github.com/perftools/xhgui/archive/0.8.1.tar.gz && \
cd /usr/local/src/ && \
tar xzvf /usr/local/src/xhgui.tar.gz && \
cd xhgui-0.8.1 && \
apt-get install -y git && \
composer install && \
echo "auto_prepend_file=/usr/local/src/xhgui-0.8.1/external/header.php" > /usr/local/etc/php/conf.d/xhgui.ini \
;fi
ARG INSTALL_LIBSODIUM=false
RUN if [ ${INSTALL_LIBSODIUM} = true ]; then \
apt-get update -yq && \
apt-get install -y libsodium-dev && \
pecl install libsodium && \
echo "extension=sodium.so" > /usr/local/etc/php/conf.d/libsodium.ini \
;fi
ARG INSTALL_GIT=false
RUN if [ ${INSTALL_GIT} = true ]; then \
apt-get update -yq && \
apt-get install -y git \
;fi
ARG INSTALL_APCU=false
ARG APCU_VERSION=5.1.21
RUN if [ ${INSTALL_APCU} = true ]; then \
pecl install apcu-${APCU_VERSION} && \
echo "extension=apcu.so" > /usr/local/etc/php/conf.d/apcu.ini && \
echo 'apc.shm_size="64M"' | tee -a /usr/local/etc/php/conf.d/apcu.ini \
;fi
ARG INSTALL_MAILPARSE=false
RUN if [ ${INSTALL_MAILPARSE} = true ]; then \
# Install mailparse extension
pecl install mailparse && \
docker-php-ext-enable mailparse \
;fi
ARG INSTALL_CSSLINT_JSHINT=false
RUN if [ ${INSTALL_CSSLINT_JSHINT} = true ]; then \
wget https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs npm && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
npm install -g csslint jshint \
;fi
RUN usermod -u 1000 www-data
WORKDIR /var/www
CMD ["php-fpm"]
EXPOSE 9000