Skip to content

Commit 9050c73

Browse files
committed
Added php7.4
1 parent 4ed8771 commit 9050c73

File tree

12 files changed

+2540
-0
lines changed

12 files changed

+2540
-0
lines changed

php7.3-blackfire/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM itkdev/php7.3-fpm
2+
LABEL maintainer "ITK Dev <[email protected]>"
3+
4+
ENV PHP_VERSION 7.3
5+
6+
RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
7+
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
8+
&& mkdir -p /tmp/blackfire \
9+
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
10+
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
11+
&& printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > /etc/php/7.3/fpm/conf.d/10-blackfire.ini \
12+
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz

php7.4-fpm/Dockerfile

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
FROM ubuntu:18.04
2+
LABEL maintainer "ITK Dev <[email protected]>"
3+
4+
ENV PHP_VERSION 7.4
5+
6+
# Ensure packages are avaiable.
7+
RUN apt-get update
8+
9+
RUN DEBIAN_FRONTEND=noninteractive \
10+
apt-get install -y \
11+
apt-utils
12+
13+
RUN apt-get install -y language-pack-en-base \
14+
software-properties-common \
15+
&& locale-gen en_US.UTF-8
16+
17+
# Add php repositories
18+
RUN LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
19+
RUN apt-get update
20+
21+
# Clean up
22+
RUN apt-get remove -y software-properties-common language-pack-en-base \
23+
&& apt-get autoremove -y
24+
25+
RUN DEBIAN_FRONTEND=noninteractive \
26+
apt-get install -y \
27+
php${PHP_VERSION} \
28+
php${PHP_VERSION}-dev \
29+
php${PHP_VERSION}-cli \
30+
php${PHP_VERSION}-common \
31+
php${PHP_VERSION}-curl \
32+
php${PHP_VERSION}-fpm \
33+
php${PHP_VERSION}-gd \
34+
php${PHP_VERSION}-json \
35+
php${PHP_VERSION}-mbstring \
36+
php${PHP_VERSION}-mysql \
37+
php${PHP_VERSION}-opcache \
38+
php${PHP_VERSION}-readline \
39+
php${PHP_VERSION}-soap \
40+
php${PHP_VERSION}-xml \
41+
php${PHP_VERSION}-xsl \
42+
php${PHP_VERSION}-zip \
43+
php${PHP_VERSION}-dev \
44+
php${PHP_VERSION}-xdebug \
45+
php${PHP_VERSION}-intl \
46+
php${PHP_VERSION}-bcmath \
47+
php${PHP_VERSION}-sqlite3 \
48+
php-imagick \
49+
php-memcached \
50+
php-pear \
51+
php-apcu \
52+
php-mongodb \
53+
libmcrypt-dev \
54+
libreadline-dev \
55+
mysql-client \
56+
unzip \
57+
git \
58+
imagemagick \
59+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
60+
61+
RUN mkdir /var/run/php/
62+
COPY etc/ /etc/
63+
64+
# Configure php
65+
RUN yes '' | pecl install redis-4.3.0
66+
RUN /usr/sbin/phpenmod redis
67+
68+
RUN sed -i '/memory_limit = 128M/c memory_limit = 256M' /etc/php/${PHP_VERSION}/fpm/php.ini \
69+
&& sed -i '/;date.timezone =/c date.timezone = Europe\/Copenhagen' /etc/php/${PHP_VERSION}/fpm/php.ini \
70+
&& sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 16M' /etc/php/${PHP_VERSION}/fpm/php.ini \
71+
&& sed -i '/post_max_size = 8M/c post_max_size = 20M' /etc/php/${PHP_VERSION}/fpm/php.ini
72+
73+
# Install composer
74+
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
75+
RUN php composer-setup.php --install-dir=/usr/local/bin --filename=composer
76+
RUN php -r "unlink('composer-setup.php');"
77+
78+
# Add mhsendmail for mailhog
79+
ADD https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64 /usr/local/bin/mhsendmail
80+
RUN chmod +x /usr/local/bin/mhsendmail
81+
82+
# Install configuration template handler
83+
ADD https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 /usr/local/bin/confd
84+
RUN chmod +x /usr/local/bin/confd
85+
86+
EXPOSE 9000
87+
88+
WORKDIR /app
89+
90+
COPY docker-entrypoint.sh /usr/local/bin/
91+
CMD [ "docker-entrypoint.sh" ]

php7.4-fpm/docker-entrypoint.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Add docker host domain to hosts file
5+
if [ ! -z "${DOCKER_HOST_DOMAIN}" ]; then
6+
echo $(getent hosts host.docker.internal | cut -d" " -f1) ${DOCKER_HOST_DOMAIN} >> /etc/hosts
7+
fi
8+
9+
# Set xdebug remote host to docker host ip.
10+
if [ ! -z "${PHP_XDEBUG}" ]; then
11+
export PHP_XDEBUG_REMOTE_HOST=$(getent hosts host.docker.internal | cut -d" " -f1)
12+
fi
13+
14+
## Run templates with configuration.
15+
/usr/local/bin/confd --onetime --backend env --confdir /etc/confd
16+
17+
## Start the php FPM process.
18+
echo "Starting PHP 7.4 FPM"
19+
php-fpm7.4 -F --pid /var/run/php/php-fpm7.4.pid -y /etc/php/7.4/fpm/php-fpm.conf
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[template]
2+
src = "php.ini.tmpl"
3+
dest = "/etc/php/7.4/fpm/php.ini"
4+
mode = "0644"
5+
keys = [
6+
"/php"
7+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[template]
2+
src = "30-sendmail.ini.tmpl"
3+
dest = "/etc/php/7.4/fpm/conf.d/30-sendmail.ini"
4+
mode = "0644"
5+
keys = [
6+
"/sendmail"
7+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[template]
2+
src = "30-sendmail.ini.tmpl"
3+
dest = "/etc/php/7.4/cli/conf.d/30-sendmail.ini"
4+
mode = "0644"
5+
keys = [
6+
"/sendmail"
7+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[template]
2+
src = "20-xdebug.ini.tmpl"
3+
dest = "/etc/php/7.4/mods-available/xdebug.ini"
4+
mode = "0644"
5+
keys = [
6+
"/xdebug"
7+
]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{{ if getenv "PHP_XDEBUG" }}
2+
zend_extension=xdebug.so
3+
xdebug.max_nesting_level = {{ getenv "PHP_XDEBUG_MAX_NESTING_LEVEL" "256" }}
4+
xdebug.remote_addr_header = "{{ getenv "PHP_XDEBUG_REMOTE_ADDR_HEADER" "" }}"
5+
xdebug.remote_autostart = {{ getenv "PHP_XDEBUG_REMOTE_AUTOSTART" "0" }}
6+
xdebug.remote_connect_back = {{ getenv "PHP_XDEBUG_REMOTE_CONNECT_BACK" "1" }}
7+
xdebug.remote_enable = {{ getenv "PHP_XDEBUG_REMOTE_ENABLE" "1" }}
8+
xdebug.remote_handler = {{ getenv "PHP_XDEBUG_REMOTE_HANDLER" "dbgp" }}
9+
xdebug.remote_host = {{ getenv "PHP_XDEBUG_REMOTE_HOST" "localhost" }}
10+
xdebug.remote_log = "{{ getenv "PHP_XDEBUG_REMOTE_LOG" "" }}"
11+
xdebug.remote_mode = {{ getenv "PHP_XDEBUG_REMOTE_MODE" "req" }}
12+
xdebug.remote_port = {{ getenv "PHP_XDEBUG_REMOTE_PORT" "9000" }}
13+
14+
{{ if getenv "PHP_XDEBUG_PROFILER" }}
15+
xdebug.profiler_aggregate = {{ getenv "PHP_XDEBUG_PROFILER_AGGREGATE" "0" }}
16+
xdebug.profiler_append = {{ getenv "PHP_XDEBUG_PROFILER_APPEND" "0" }}
17+
xdebug.profiler_enable = {{ getenv "PHP_XDEBUG_PROFILER_ENABLE" "0" }}
18+
xdebug.profiler_enable_trigger = {{ getenv "PHP_XDEBUG_PROFILER_ENABLE_TRIGGER" "0" }}
19+
xdebug.profiler_enable_trigger_value = "{{ getenv "PHP_XDEBUG_PROFILER_ENABLE_TRIGGER_VALUE" "" }}"
20+
xdebug.profiler_output_dir = {{ getenv "PHP_XDEBUG_PROFILER_FILES_DIR" }}/xdebug/profiler
21+
xdebug.profiler_output_name = {{ getenv "PHP_XDEBUG_PROFILER_OUTPUT_NAME" "cachegrind.out.%p" }}
22+
{{ end }}
23+
24+
{{ end }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ if getenv "PHP_MAIL" }}
2+
sendmail_path = '/usr/local/bin/mhsendmail --smtp-addr="{{ getenv "PHP_MAIL_SERVER" "mailhog" }}:{{ getenv "PHP_MAIL_PORT" "1025" }}"'
3+
{{ end }}

0 commit comments

Comments
 (0)