Skip to content

Commit be855b4

Browse files
committed
✨ Initial commit!
0 parents  commit be855b4

File tree

3 files changed

+180
-0
lines changed

3 files changed

+180
-0
lines changed

Dockerfile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#
2+
# PHP-fpm container based on official PHP 7.3 image with additional extensions
3+
# like zip, pdo_mysql, bcmath, oci8 and gd. Image is build for Laravel applications.
4+
#
5+
# OS: Debian 9 Streatch-slim
6+
#
7+
FROM php:7.3-fpm
8+
9+
#
10+
#--------------------------------------------------------------------------
11+
# General Updates
12+
#--------------------------------------------------------------------------
13+
#
14+
15+
# Update OS packages and install required ones.
16+
RUN apt-get update && \
17+
apt-get upgrade -y && \
18+
apt-get install -y --no-install-recommends \
19+
curl \
20+
libmemcached-dev \
21+
libz-dev \
22+
libpq-dev \
23+
libjpeg-dev \
24+
libpng-dev \
25+
libfreetype6-dev \
26+
libssl-dev \
27+
libmcrypt-dev \
28+
zip \
29+
unzip \
30+
build-essential \
31+
libaio1 \
32+
libzip-dev \
33+
ntp \
34+
&& apt-get clean \
35+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
36+
&& rm /var/log/lastlog /var/log/faillog \
37+
&& echo Europe/Prague >/etc/timezone \
38+
&& dpkg-reconfigure -f noninteractive tzdata
39+
40+
#
41+
#--------------------------------------------------------------------------
42+
# Application Dependencies
43+
#--------------------------------------------------------------------------
44+
#
45+
46+
# Download oracle packages and install OCI8
47+
RUN curl -o instantclient-basic-193000.zip https://dependencies.silencesys.dev/instantclient-basic-193000.zip \
48+
&& unzip instantclient-basic-193000.zip -d /usr/lib/oracle/ \
49+
&& rm instantclient-basic-193000.zip \
50+
&& curl -o instantclient-basic-193000.zip https://dependencies.silencesys.dev/instantclient-sdk-193000.zip \
51+
&& unzip instantclient-basic-193000.zip -d /usr/lib/oracle/ \
52+
&& rm instantclient-basic-193000.zip \
53+
&& echo /usr/lib/oracle/instantclient_19_3 > /etc/ld.so.conf.d/oracle-instantclient.conf \
54+
&& ldconfig
55+
56+
ENV LD_LIBRARY_PATH /usr/lib/oracle/instantclient_19_3
57+
58+
# Install PHP extensions: Laravel needs also zip, mysqli and bcmath which
59+
# are not included in default image. Also install our compiled oci8 extensions.
60+
RUN docker-php-ext-install zip pdo_mysql tokenizer bcmath opcache pcntl \
61+
&& docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/lib/oracle/instantclient_19_3 \
62+
&& docker-php-ext-install -j$(nproc) oci8 \
63+
# Install the PHP gd library
64+
&& docker-php-ext-configure gd \
65+
--with-jpeg-dir=/usr/lib \
66+
--with-freetype-dir=/usr/include/freetype2 && \
67+
docker-php-ext-install gd
68+
69+
#
70+
#--------------------------------------------------------------------------
71+
# Final Touch
72+
#--------------------------------------------------------------------------
73+
#
74+
75+
# Copy our configs to the image.
76+
COPY ./config/evaluations.ini /usr/local/etc/php/conf.d
77+
COPY ./config/pool.d/evaluations.conf /usr/local/etc/php-fpm.d/
78+
79+
# Expose port 9000 and start php-fpm server
80+
CMD ["php-fpm"]
81+
EXPOSE 9000

config/custom.ini

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
date.timezone=UTC
2+
display_errors=Off
3+
log_errors=On
4+
5+
opcache.enable=1
6+
opcache.enable_cli=1
7+
8+
; Maximum amount of memory a script may consume (128MB)
9+
; http://php.net/memory-limit
10+
memory_limit = 768M
11+
12+
; Maximum allowed size for uploaded files.
13+
; http://php.net/upload-max-filesize
14+
15+
upload_max_filesize = 20M
16+
; Sets max size of post data allowed.
17+
; http://php.net/post-max-size
18+
19+
post_max_size = 20M
20+
max_execution_time=360
21+
max_input_time=360
22+
default_socket_timeout=3600
23+
request_terminate_timeout=600

config/pool.d/custom.conf

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
; Unix user/group of processes
2+
; Note: The user is mandatory. If the group is not set, the default user's group
3+
; will be used.
4+
user = www-data
5+
group = www-data
6+
7+
; The address on which to accept FastCGI requests.
8+
; Valid syntaxes are:
9+
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
10+
; a specific port;
11+
; 'port' - to listen on a TCP socket to all addresses on a
12+
; specific port;
13+
; '/path/to/unix/socket' - to listen on a unix socket.
14+
; Note: This value is mandatory.
15+
listen = 0.0.0.0:9000
16+
17+
; Choose how the process manager will control the number of child processes.
18+
; Possible Values:
19+
; static - a fixed number (pm.max_children) of child processes;
20+
; dynamic - the number of child processes are set dynamically based on the
21+
; following directives. With this process management, there will be
22+
; always at least 1 children.
23+
; pm.max_children - the maximum number of children that can
24+
; be alive at the same time.
25+
; pm.start_servers - the number of children created on startup.
26+
; pm.min_spare_servers - the minimum number of children in 'idle'
27+
; state (waiting to process). If the number
28+
; of 'idle' processes is less than this
29+
; number then some children will be created.
30+
; pm.max_spare_servers - the maximum number of children in 'idle'
31+
; state (waiting to process). If the number
32+
; of 'idle' processes is greater than this
33+
; number then some children will be killed.
34+
; ondemand - no children are created at startup. Children will be forked when
35+
; new requests will connect. The following parameter are used:
36+
; pm.max_children - the maximum number of children that
37+
; can be alive at the same time.
38+
; pm.process_idle_timeout - The number of seconds after which
39+
; an idle process will be killed.
40+
; Note: This value is mandatory.
41+
pm = dynamic
42+
43+
; The number of child processes to be created when pm is set to 'static' and the
44+
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
45+
; This value sets the limit on the number of simultaneous requests that will be
46+
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
47+
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
48+
; CGI. The below defaults are based on a server without much resources. Don't
49+
; forget to tweak pm.* to fit your needs.
50+
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
51+
; Note: This value is mandatory.
52+
pm.max_children = 30
53+
54+
; The number of child processes created on startup.
55+
; Note: Used only when pm is set to 'dynamic'
56+
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
57+
pm.start_servers = 10
58+
59+
; The desired minimum number of idle server processes.
60+
; Note: Used only when pm is set to 'dynamic'
61+
; Note: Mandatory when pm is set to 'dynamic'
62+
pm.min_spare_servers = 5
63+
64+
; The desired maximum number of idle server processes.
65+
; Note: Used only when pm is set to 'dynamic'
66+
; Note: Mandatory when pm is set to 'dynamic'
67+
pm.max_spare_servers = 15
68+
69+
;---------------------
70+
71+
; Make specific Docker environment variables available to PHP
72+
env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE
73+
env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER
74+
env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD
75+
76+
catch_workers_output = yes

0 commit comments

Comments
 (0)