Skip to content

Commit 9418735

Browse files
committed
init
0 parents  commit 9418735

File tree

7 files changed

+396
-0
lines changed

7 files changed

+396
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/nginx/*
2+
.git
3+
Readme.md

Dockerfile

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
FROM php:7.1.9-fpm
2+
3+
4+
RUN apt-get update \
5+
&& apt-get install -y --no-install-recommends \
6+
curl \
7+
libicu-dev \
8+
libmemcached-dev \
9+
libz-dev \
10+
libpq-dev \
11+
libjpeg-dev \
12+
libpng12-dev \
13+
libfreetype6-dev \
14+
libssl-dev \
15+
libmcrypt-dev \
16+
libxml2-dev \
17+
libbz2-dev \
18+
libjpeg62-turbo-dev \
19+
php-pear \
20+
curl \
21+
git \
22+
subversion \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
26+
# Install various PHP extensions
27+
RUN docker-php-ext-configure bcmath --enable-bcmath \
28+
&& docker-php-ext-configure pcntl --enable-pcntl \
29+
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql \
30+
&& docker-php-ext-configure pdo_pgsql --with-pgsql \
31+
&& docker-php-ext-configure mbstring --enable-mbstring \
32+
&& docker-php-ext-configure soap --enable-soap \
33+
&& docker-php-ext-install \
34+
bcmath \
35+
intl \
36+
mbstring \
37+
mcrypt \
38+
mysqli \
39+
pcntl \
40+
pdo_mysql \
41+
pdo_pgsql \
42+
soap \
43+
sockets \
44+
zip \
45+
&& docker-php-ext-configure gd \
46+
--enable-gd-native-ttf \
47+
--with-jpeg-dir=/usr/lib \
48+
--with-freetype-dir=/usr/include/freetype2 && \
49+
docker-php-ext-install gd \
50+
&& docker-php-ext-install opcache \
51+
&& docker-php-ext-enable opcache
52+
53+
54+
# AST
55+
RUN git clone https://github.com/nikic/php-ast /usr/src/php/ext/ast/ && \
56+
docker-php-ext-configure ast && \
57+
docker-php-ext-install ast
58+
59+
60+
# ICU - intl requirements for Symfony
61+
# Debian is out of date, and Symfony expects the latest - so build from source, unless a better alternative exists(?)
62+
RUN curl -sS -o /tmp/icu.tar.gz -L http://download.icu-project.org/files/icu4c/58.2/icu4c-58_2-src.tgz \
63+
&& tar -zxf /tmp/icu.tar.gz -C /tmp \
64+
&& cd /tmp/icu/source \
65+
&& ./configure --prefix=/usr/local \
66+
&& make \
67+
&& make install
68+
69+
RUN docker-php-ext-configure intl --with-icu-dir=/usr/local \
70+
&& docker-php-ext-install intl
71+
72+
73+
# Install the php memcached extension
74+
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
75+
&& mkdir -p memcached \
76+
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
77+
&& ( \
78+
cd memcached \
79+
&& phpize \
80+
&& ./configure \
81+
&& make -j$(nproc) \
82+
&& make install \
83+
) \
84+
&& rm -r memcached \
85+
&& rm /tmp/memcached.tar.gz \
86+
&& docker-php-ext-enable memcached
87+
88+
# Copy opcache configration
89+
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
90+
91+
92+
# Install xDebug, if enabled
93+
ARG INSTALL_XDEBUG=false
94+
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
95+
# Install the xdebug extension
96+
pecl install xdebug && \
97+
docker-php-ext-enable xdebug \
98+
;fi
99+
100+
101+
# Copy xdebug configration for remote debugging
102+
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
103+
104+
# Copy timezone configration
105+
COPY ./timezone.ini /usr/local/etc/php/conf.d/timezone.ini
106+
107+
108+
# Set timezone
109+
RUN rm /etc/localtime
110+
RUN ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
111+
RUN "date"
112+
113+
114+
# Short open tags fix - another Symfony requirements
115+
COPY ./custom-php.ini /usr/local/etc/php/conf.d/custom-php.ini
116+
117+
# Composer
118+
ENV COMPOSER_HOME /var/www/.composer
119+
120+
RUN curl -sS https://getcomposer.org/installer | php -- \
121+
--install-dir=/usr/bin \
122+
--filename=composer
123+
124+
125+
RUN chown -R www-data:www-data /var/www/
126+
127+
RUN mkdir -p $COMPOSER_HOME/cache
128+
129+
VOLUME $COMPOSER_HOME

Readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Docker PHP 7.x Base Image
2+
3+
I use this as a base for Symfony development work.
4+
5+
For further information please see the [Docker Tutorial for Beginners][1].
6+
7+
8+
[1]: https://codereviewvideos.com/course/docker-tutorial-for-beginners

custom-php.ini

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
[PHP]
2+
3+
;;;;;;;;;;;;;;;;;;;;
4+
; Language Options ;
5+
;;;;;;;;;;;;;;;;;;;;
6+
7+
engine = On
8+
short_open_tag = Off
9+
asp_tags = Off
10+
precision = 14
11+
output_buffering = 4096
12+
13+
zlib.output_compression = Off
14+
15+
implicit_flush = Off
16+
unserialize_callback_func =
17+
serialize_precision = 17
18+
disable_functions =
19+
disable_classes =
20+
21+
zend.enable_gc = On
22+
23+
;;;;;;;;;;;;;;;;;
24+
; Miscellaneous ;
25+
;;;;;;;;;;;;;;;;;
26+
27+
expose_php = On
28+
29+
;;;;;;;;;;;;;;;;;;;
30+
; Resource Limits ;
31+
;;;;;;;;;;;;;;;;;;;
32+
33+
max_execution_time = 60
34+
max_input_time = 60
35+
max_input_vars = 1000
36+
memory_limit = -1
37+
38+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39+
; Error handling and logging ;
40+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41+
42+
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
43+
display_errors = Off
44+
display_startup_errors = Off
45+
log_errors = On
46+
log_errors_max_len = 1024
47+
ignore_repeated_errors = Off
48+
ignore_repeated_source = Off
49+
report_memleaks = On
50+
track_errors = Off
51+
html_errors = On
52+
53+
;;;;;;;;;;;;;;;;;
54+
; Data Handling ;
55+
;;;;;;;;;;;;;;;;;
56+
57+
variables_order = "GPCS"
58+
request_order = "GP"
59+
register_argc_argv = Off
60+
auto_globals_jit = On
61+
62+
post_max_size = 32M
63+
auto_prepend_file =
64+
auto_append_file =
65+
66+
default_mimetype = "text/html"
67+
always_populate_raw_post_data = -1
68+
69+
;;;;;;;;;;;;;;;;;;;;;;;;;
70+
; Paths and Directories ;
71+
;;;;;;;;;;;;;;;;;;;;;;;;;
72+
73+
doc_root =
74+
user_dir =
75+
76+
enable_dl = Off
77+
78+
realpath_cache_size = 4096K
79+
realpath_cache_ttl = 600
80+
81+
;;;;;;;;;;;;;;;;
82+
; File Uploads ;
83+
;;;;;;;;;;;;;;;;
84+
85+
file_uploads = On
86+
upload_max_filesize = 64M
87+
max_file_uploads = 20
88+
89+
;;;;;;;;;;;;;;;;;;
90+
; Fopen wrappers ;
91+
;;;;;;;;;;;;;;;;;;
92+
93+
allow_url_fopen = On
94+
allow_url_include = Off
95+
96+
default_socket_timeout = 60
97+
98+
;;;;;;;;;;;;;;;;;;;
99+
; Module Settings ;
100+
;;;;;;;;;;;;;;;;;;;
101+
102+
[CLI Server]
103+
cli_server.color = On
104+
105+
[Date]
106+
date.timezone = UTC
107+
108+
[Pdo_mysql]
109+
pdo_mysql.cache_size = 2000
110+
pdo_mysql.default_socket=
111+
112+
[mail function]
113+
; For Win32 only.
114+
SMTP = localhost
115+
smtp_port = 25
116+
117+
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
118+
sendmail_path = /usr/sbin/sendmail -t -i
119+
120+
mail.add_x_header = On
121+
122+
[SQL]
123+
sql.safe_mode = Off
124+
125+
[ODBC]
126+
odbc.allow_persistent = On
127+
odbc.check_persistent = On
128+
odbc.max_persistent = -1
129+
odbc.max_links = -1
130+
odbc.defaultlrl = 4096
131+
odbc.defaultbinmode = 1
132+
133+
[MySQL]
134+
mysql.allow_local_infile = On
135+
mysql.allow_persistent = On
136+
mysql.cache_size = 2000
137+
mysql.max_persistent = -1
138+
mysql.max_links = -1
139+
mysql.default_port =
140+
mysql.default_socket =
141+
mysql.default_host =
142+
mysql.default_user =
143+
mysql.default_password =
144+
mysql.connect_timeout = 60
145+
mysql.trace_mode = Off
146+
147+
[MySQLi]
148+
mysqli.max_persistent = -1
149+
mysqli.allow_persistent = On
150+
mysqli.max_links = -1
151+
mysqli.cache_size = 2000
152+
mysqli.default_port = 3306
153+
mysqli.default_socket =
154+
mysqli.default_host =
155+
mysqli.default_user =
156+
mysqli.default_pw =
157+
mysqli.reconnect = Off
158+
159+
[mysqlnd]
160+
mysqlnd.collect_statistics = On
161+
mysqlnd.collect_memory_statistics = Off
162+
163+
[PostgreSQL]
164+
pgsql.allow_persistent = On
165+
pgsql.auto_reset_persistent = Off
166+
pgsql.max_persistent = -1
167+
pgsql.max_links = -1
168+
pgsql.ignore_notice = 0
169+
pgsql.log_notice = 0
170+
171+
[bcmath]
172+
bcmath.scale = 0
173+
174+
[Session]
175+
session.save_handler = files
176+
session.save_path =
177+
session.use_cookies = 1
178+
session.use_only_cookies = 1
179+
session.name = PHPSESSID
180+
session.auto_start = 0
181+
182+
session.cookie_lifetime = 0
183+
session.cookie_path = /
184+
session.cookie_domain =
185+
session.cookie_httponly =
186+
187+
session.serialize_handler = php
188+
189+
session.gc_probability = 1
190+
session.gc_divisor = 1000
191+
session.gc_maxlifetime = 1440
192+
193+
session.bug_compat_42 = Off
194+
session.bug_compat_warn = Off
195+
session.referer_check =
196+
197+
session.cache_limiter = nocache
198+
session.cache_expire = 180
199+
200+
session.use_trans_sid = 0
201+
202+
session.hash_function = 0
203+
session.hash_bits_per_character = 5
204+
205+
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
206+
207+
[MSSQL]
208+
mssql.allow_persistent = On
209+
mssql.max_persistent = -1
210+
mssql.max_links = -1
211+
mssql.min_error_severity = 10
212+
mssql.min_message_severity = 10
213+
mssql.compatability_mode = Off
214+
mssql.secure_connection = Off
215+
216+
[Tidy]
217+
tidy.clean_output = Off
218+
219+
[soap]
220+
soap.wsdl_cache_enabled=1
221+
soap.wsdl_cache_dir="/tmp"
222+
soap.wsdl_cache_ttl=86400
223+
soap.wsdl_cache_limit = 5
224+
225+
[ldap]
226+
ldap.max_links = -1
227+
228+
229+
[Opcache]
230+
opcache.max_accelerated_files = 20000

opcache.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; NOTE: The actual opcache.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini)
2+
3+
opcache.enable="1"
4+
opcache.memory_consumption="256"
5+
opcache.use_cwd="0"
6+
opcache.max_file_size="0"
7+
opcache.max_accelerated_files = 30000
8+
opcache.validate_timestamps="1"
9+
opcache.revalidate_freq="0"

timezone.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[Date]
2+
; Defines the default timezone used by the date functions
3+
; http://php.net/date.timezone
4+
date.timezone = Europe/London

0 commit comments

Comments
 (0)