-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
217 lines (173 loc) · 6.5 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
# PHP-FPM 7 Docker Container
# Base Dockerfile: composer/base
FROM php:7.2-fpm
MAINTAINER Nicolas Dhers <[email protected]>
# User conf
ENV RUN_UID=8181
ENV RUN_GID=8181
# Packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
bash \
sudo \
locales \
gettext \
zlib1g-dev libicu-dev g++ \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libbz2-dev \
libxslt-dev \
libldap2-dev \
curl \
git \
unzip \
wget \
nano \
mysql-client \
build-essential \
dos2unix \
ntp \
&& rm -r /var/lib/apt/lists/*
# Language config
# RUN sed -i -e 's/# fr_FR ISO-8859-1/fr_FR ISO-8859-1/' /etc/locale.gen && \
# dpkg-reconfigure --frontend=noninteractive locales
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
RUN echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen
RUN echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen
RUN echo "it_IT.UTF-8 UTF-8" >> /etc/locale.gen
RUN locale-gen && \
dpkg-reconfigure --frontend=noninteractive locales
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:en
ENV LC_ALL fr_FR.UTF-8
# Time config
# Conf settings
ENV PHP_CONF_FILE=/etc/php/7.2/fpm/conf.d/20-system.ini \
PHP_CONF_FILE_CLI=/etc/php/7.2/cli/conf.d/20-system.ini \
PHP_CONF_TIMEZONE=UTC \
PHP_CONF_MAX_EXECUTION_TIME=30 \
PHP_CONF_UPLOAD_LIMIT=40M \
PHP_CONF_PHAR_READONLY=off \
PHP_CONF_MEMORY_LIMIT=512M \
PHP_CONF_DISPLAY_ERRORS=off \
PHP_CONF_ERROR_REPORTING=0 \
PHP_CONF_OPCACHE_ENABLE=0 \
PHP_CONF_OPCACHE_ENABLE_CLI=0 \
PHP_CONF_OPCACHE_MEMORY_CONSUMPTION=128 \
PHP_CONF_OPCACHE_INTERNED_STRINGS_BUFFER=8 \
PHP_CONF_OPCACHE_MAX_ACCELERATED_FILES=4000 \
PHP_CONF_OPCACHE_MAX_WASTED_PERCENTAGE=20 \
PHP_CONF_OPCACHE_VALIDATE_TIMESTAMPS=0 \
PHP_CONF_OPCACHE_REVALIDATE_FREQ=60 \
PHP_CONF_OPCACHE_FAST_SHUTDOWN=0
# Pool settings
ENV PHP_POOL_FILE=/etc/php/7.2/fpm/pool.d/20-system.pool.conf \
PHP_POOL_USER=www-data \
PHP_POOL_GROUP=www-data \
PHP_POOL_LISTEN_HOST=127.0.0.1 \
PHP_POOL_LISTEN_PORT=9000 \
PHP_POOL_PM_CONTROL=dynamic \
PHP_POOL_PM_MAX_CHILDREN=20 \
PHP_POOL_PM_START_SERVERS=2 \
PHP_POOL_PM_MIN_SPARE_SERVERS=1 \
PHP_POOL_PM_MAX_SPARE_SERVERS=3 \
PHP_CONF_OPCACHE_ENABLE=0
# RUN ntpd -gq \
# && service ntp start &&\
# echo "$TIMEZONE" > /etc/timezone &&\
# ln -sf "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime &&\
# dpkg-reconfigure -f noninteractive tzdata
# # Time Zone
# RUN echo "date.timezone=$TIMEZONE" > $PHP_INI_DIR/conf.d/10-date_timezone.ini
# PHP
# PHP Extensions
RUN pecl install redis
RUN pecl install mcrypt-1.0.1
RUN docker-php-ext-install bcmath zip bz2 mbstring xsl gettext \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd \
&& docker-php-ext-install pdo pdo_mysql mysqli \
&& docker-php-ext-enable redis \
&& docker-php-ext-enable mcrypt \
&& docker-php-ext-enable gettext \
&& docker-php-ext-configure opcache --enable-opcache \
&& docker-php-ext-install opcache
# RUN echo extension=gettext.so > /usr/local/etc/php/conf.d/gettext.ini
RUN echo "PHP $PHP_VERSION configured, with extensions and special conf files" &&\
ls -l $PHP_INI_DIR/conf.d
# Composer
# Register the COMPOSER_HOME environment variable
ENV COMPOSER_HOME /composer
# Add global binary directory to PATH and make sure to re-export it
ENV PATH /composer/vendor/bin:$PATH
# Allow Composer to be run as root
ENV COMPOSER_ALLOW_SUPERUSER 1
# Setup the Composer installer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }"
ENV COMPOSER_VERSION master
# Install Composer
RUN php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --snapshot && rm -rf /tmp/composer-setup.php
# Setup the Composer installer and extensions
RUN composer global require 'phing/phing=2.*' &&\
composer global require 'phpunit/phpunit=*' &&\
composer global require 'theseer/phpdox=@stable'
# WP-cli
RUN curl -o /bin/wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
COPY scripts/wp-su.sh /bin/wp
# RUN ln -s /bin/wp-cli.phar /bin/wp
RUN chmod +x /bin/wp-cli.phar /bin/wp && \
dos2unix /bin/wp
# NPM / Yarn
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg \
&& rm -r /var/lib/apt/lists/*
RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs yarn \
&& rm -r /var/lib/apt/lists/*
RUN npm install -g gulp bower
# Mailcatcher
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
ruby-full \
libsqlite3-dev \
&& rm -r /var/lib/apt/lists/*
RUN gem install mailcatcher --no-rdoc --no-ri
# CacheTool
RUN curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar && \
mv cachetool.phar /usr/bin/cachetool && \
chmod +x /usr/bin/cachetool
# Drush install
# Install Drush 8 with the phar file.
# Set the Drush version.
ENV DRUSH_VERSION 8.1.16
RUN curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/releases/download/$DRUSH_VERSION/drush.phar" && \
chmod +x /usr/local/bin/drush
RUN drush core-status
# new entrypoint (config with env vars)
COPY scripts/docker-php-entrypoint-new /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-entrypoint-new && \
dos2unix /usr/local/bin/docker-php-entrypoint-new
COPY scripts/php-init /usr/local/bin/
RUN chmod +x /usr/local/bin/php-init && \
dos2unix /usr/local/bin/php-init
# runtime configs
ADD conf/00-custom.conf /usr/local/etc/php/php-custom.conf
COPY commands/setup-* /root/
RUN chmod +x /root/setup-cli-conf.sh && \
chmod +x /root/setup-fpm-conf.sh && \
chmod +x /root/setup-fpm-pool.sh && \
dos2unix /root/setup-cli-conf.sh && \
dos2unix /root/setup-fpm-conf.sh && \
dos2unix /root/setup-fpm-pool.sh
# ENTRYPOINT ["/usr/local/bin/docker-php-entrypoint-new"]
CMD ["php-init"]
WORKDIR /var/www