Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

Commit 9a0bda6

Browse files
committed
add php 7.4 and internalize mhsendmail
due to unknown issues when downloading mhsendmail added it to the repo and use a update script to get potentially new versions. Signed-off-by: BlackEagle <[email protected]>
1 parent 1282dbe commit 9a0bda6

40 files changed

+518
-30
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/mhsendmail

.gitlab-ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ build:7.3:
6060
only:
6161
- master
6262

63+
build:7.4:
64+
stage: build
65+
tags:
66+
- dockerwest
67+
script:
68+
- cd 7.4; ./build.sh
69+
only:
70+
- master
71+
6372
release:5.6:
6473
stage: release
6574
tags:
@@ -105,6 +114,15 @@ release:7.3:
105114
only:
106115
- master
107116

117+
release:7.4:
118+
stage: release
119+
tags:
120+
- dockerwest
121+
script:
122+
- docker push dockerwest/php:7.4
123+
only:
124+
- master
125+
108126
trigger:php-laravel:
109127
stage: trigger
110128
trigger:
@@ -129,3 +147,8 @@ trigger:php-symfony:
129147
stage: trigger
130148
trigger:
131149
project: DockerWest/php-symfony
150+
151+
trigger:php-sylius:
152+
stage: trigger
153+
trigger:
154+
project: DockerWest/php-sylius

5.6/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch-slim
1+
FROM debian:stable-slim
22

33
ENV DEBIAN_FRONTEND=noninteractive
44
ENV DW_PHP_VERSION=5.6

5.6/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
2-
#docker pull debian:stretch-slim
2+
#docker pull debian:stable-slim
33

44
docker build --no-cache -t dockerwest/php:5.6 .

5.6/scripts/install-development.sh

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ curl -LsS https://getcomposer.org/installer | \
1818
[[ -e Tideways.php ]] || false && true
1919
)
2020

21-
curl -LsSO "https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64"
22-
mv mhsendmail_linux_amd64 /usr/local/lib/mhsendmail
23-
chmod +x /usr/local/lib/mhsendmail
24-
2521
printf "xdebug.remote_enable = 1\nxdebug.remote_connect_back = 1\nxdebug.max_nesting_level=400\n" \
2622
>> /etc/php/${DW_PHP_VERSION}/mods-available/xdebug.ini
2723

5.6/scripts/usr/local/lib/mhsendmail

5.61 MB
Binary file not shown.

7.0/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch-slim
1+
FROM debian:stable-slim
22

33
ENV DEBIAN_FRONTEND=noninteractive
44
ENV DW_PHP_VERSION=7.0

7.0/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
2-
#docker pull debian:stretch-slim
2+
#docker pull debian:stable-slim
33

44
docker build --no-cache -t dockerwest/php:7.0 .

7.0/scripts/install-development.sh

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ curl -LsS https://getcomposer.org/installer | \
1818
[[ -e Tideways.php ]] || false && true
1919
)
2020

21-
curl -LsSO "https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64"
22-
mv mhsendmail_linux_amd64 /usr/local/lib/mhsendmail
23-
chmod +x /usr/local/lib/mhsendmail
24-
2521
printf "xdebug.remote_enable = 1\nxdebug.remote_connect_back = 1\nxdebug.max_nesting_level=400\n" \
2622
>> /etc/php/${DW_PHP_VERSION}/mods-available/xdebug.ini
2723

7.0/scripts/usr/local/lib/mhsendmail

5.61 MB
Binary file not shown.

7.1/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch-slim
1+
FROM debian:stable-slim
22

33
ENV DEBIAN_FRONTEND=noninteractive
44
ENV DW_PHP_VERSION=7.1

7.1/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
2-
#docker pull debian:stretch-slim
2+
#docker pull debian:stable-slim
33

44
docker build --no-cache -t dockerwest/php:7.1 .

7.1/scripts/install-development.sh

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ curl -LsS https://getcomposer.org/installer | \
1818
[[ -e Tideways.php ]] || false && true
1919
)
2020

21-
curl -LsSO "https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64"
22-
mv mhsendmail_linux_amd64 /usr/local/lib/mhsendmail
23-
chmod +x /usr/local/lib/mhsendmail
24-
2521
printf "xdebug.remote_enable = 1\nxdebug.remote_connect_back = 1\nxdebug.max_nesting_level=400\n" \
2622
>> /etc/php/${DW_PHP_VERSION}/mods-available/xdebug.ini
2723

7.1/scripts/usr/local/lib/mhsendmail

5.61 MB
Binary file not shown.

7.2/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch-slim
1+
FROM debian:stable-slim
22

33
ENV DEBIAN_FRONTEND=noninteractive
44
ENV DW_PHP_VERSION=7.2

7.2/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
2-
#docker pull debian:stretch-slim
2+
#docker pull debian:stable-slim
33

44
docker build --no-cache -t dockerwest/php:7.2 .

7.2/scripts/install-development.sh

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ curl -LsS https://getcomposer.org/installer | \
1818
[[ -e Tideways.php ]] || false && true
1919
)
2020

21-
curl -LsSO "https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64"
22-
mv mhsendmail_linux_amd64 /usr/local/lib/mhsendmail
23-
chmod +x /usr/local/lib/mhsendmail
24-
2521
printf "xdebug.remote_enable = 1\nxdebug.remote_connect_back = 1\nxdebug.max_nesting_level=400\n" \
2622
>> /etc/php/${DW_PHP_VERSION}/mods-available/xdebug.ini
2723

7.2/scripts/usr/local/lib/mhsendmail

5.61 MB
Binary file not shown.

7.3/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:stretch-slim
1+
FROM debian:stable-slim
22

33
ENV DEBIAN_FRONTEND=noninteractive
44
ENV DW_PHP_VERSION=7.3

7.3/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env sh
2-
#docker pull debian:stretch-slim
2+
#docker pull debian:stable-slim
33

44
docker build --no-cache -t dockerwest/php:7.3 .

7.3/scripts/install-development.sh

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ curl -LsS https://getcomposer.org/installer | \
1818
[[ -e Tideways.php ]] || false && true
1919
)
2020

21-
curl -LsSO "https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64"
22-
mv mhsendmail_linux_amd64 /usr/local/lib/mhsendmail
23-
chmod +x /usr/local/lib/mhsendmail
24-
2521
printf "xdebug.remote_enable = 1\nxdebug.remote_connect_back = 1\nxdebug.max_nesting_level=400\n" \
2622
>> /etc/php/${DW_PHP_VERSION}/mods-available/xdebug.ini
2723

7.3/scripts/usr/local/lib/mhsendmail

5.61 MB
Binary file not shown.

7.4/Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM debian:stable-slim
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV DW_PHP_VERSION=7.4
5+
6+
COPY ./scripts /
7+
RUN /install.sh && rm /install*
8+
9+
EXPOSE 9000
10+
VOLUME ["/xhprof", "/xdebug"]
11+
WORKDIR /phpapp
12+
13+
ENTRYPOINT ["/command.sh"]
14+
CMD ["php-fpm7.4"]
15+
16+
HEALTHCHECK --interval=10s --timeout=3s CMD /health.sh

7.4/build.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
#docker pull debian:stable-slim
3+
4+
docker build --no-cache -t dockerwest/php:7.4 .

7.4/scripts/command.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
if [[ "php-fpm${DW_PHP_VERSION}" == "$1" ]]; then
4+
touch /run/php/.checkfpm
5+
fi
6+
7+
/prepare.sh
8+
9+
[[ -f /prepare-command.sh ]] && bash /prepare-command.sh
10+
11+
if [[ 0 = "$UID" ]] && [[ "php-fpm${DW_PHP_VERSION}" != "$1" ]] && [[ "/bin/bash" != "$1" ]]; then
12+
exec gosu www-data "$@"
13+
else
14+
exec "$@"
15+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
; priority=80
2+
memory_limit = 256M
3+
display_errors = Off
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; priority=90
2+
date.timezone = "Europe/Brussels"
3+
display_errors = On
4+
error_reporting = -1
5+
max_execution_time = 120
6+
7+
sendmail_path = "/usr/local/lib/mhsendmail --smtp-addr=mailcatcher:1025"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; priority=80
2+
opcache.enable_cli=1
3+
opcache.memory_consumption=128
4+
opcache.max_accelerated_files=10000
5+
opcache.validate_timestamps=0
6+
opcache.consistency_checks=0
7+
opcache.save_comments=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
; priority=80
2+
xdebug.profiler_enable=1
3+
xdebug.profiler_output_dir=/xdebug
4+
xdebug.profiler_output_name=cachegrind.out.%u

7.4/scripts/health.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
if [[ -e /run/php/.checkfpm ]]; then
4+
php -n /usr/local/bin/php-health.phar
5+
exit $?
6+
else
7+
exit 0
8+
fi

7.4/scripts/install-development.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
curl -LsS https://packages.blackfire.io/gpg.key | apt-key add -
6+
echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list
7+
8+
apt-get update
9+
apt-get install -y php-xdebug php-tideways git blackfire-php
10+
apt-get clean -y
11+
curl -LsS https://getcomposer.org/installer | \
12+
php -- --install-dir=/usr/local/lib --filename=composer
13+
[[ -e /usr/local/lib/composer ]] || false && true
14+
15+
(
16+
cd /usr/lib/php/$(php -i | grep ^extension_dir | sed -e 's/.*\/\([0-9]*\).*/\1/')
17+
curl -O https://raw.githubusercontent.com/tideways/profiler/master/Tideways.php
18+
[[ -e Tideways.php ]] || false && true
19+
)
20+
21+
printf "xdebug.remote_enable = 1\nxdebug.remote_connect_back = 1\nxdebug.max_nesting_level=400\n" \
22+
>> /etc/php/${DW_PHP_VERSION}/mods-available/xdebug.ini
23+
24+
if [[ -e /etc/php/${DW_PHP_VERSION}/mods-available/tideways.ini ]]; then
25+
cp -a /etc/php/${DW_PHP_VERSION}/mods-available/tideways.ini \
26+
/etc/php/${DW_PHP_VERSION}/mods-available/xhprof.ini
27+
28+
printf "auto_prepend_file=/usr/share/xhprof/prepend.php\n" \
29+
>> /etc/php/${DW_PHP_VERSION}/mods-available/xhprof.ini
30+
31+
printf "tideways.udp_connection=\"tideways:8135\"\ntideways.connection=\"tcp://tideways:9135\"\ntideways.monitor_cli=1\n" \
32+
>> /etc/php/${DW_PHP_VERSION}/mods-available/tideways.ini
33+
printf "auto_prepend_file=/usr/share/tideways/prepend.php\n" \
34+
>> /etc/php/${DW_PHP_VERSION}/mods-available/tideways.ini
35+
fi
36+
37+
if [[ -e /etc/php/${DW_PHP_VERSION}/mods-available/blackfire.ini ]]; then
38+
sed -e 's#\(blackfire.agent_socket\).*#\1=tcp://blackfire:8707#' \
39+
-i /etc/php/${DW_PHP_VERSION}/mods-available/blackfire.ini
40+
fi
41+
42+
phpdismod xdebug
43+
phpdismod tideways
44+
phpdismod blackfire

7.4/scripts/install.sh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# ondrej debian
6+
apt-get update
7+
apt-get install -y apt-transport-https lsb-release ca-certificates curl \
8+
liblz4-tool gnupg unzip
9+
curl -o /etc/apt/trusted.gpg.d/php.gpg \
10+
https://packages.sury.org/php/apt.gpg
11+
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" \
12+
> /etc/apt/sources.list.d/php.list
13+
14+
# install packages
15+
apt-get update
16+
apt-get upgrade -y
17+
apt-get install -y php${DW_PHP_VERSION}-cli \
18+
php${DW_PHP_VERSION}-fpm \
19+
php${DW_PHP_VERSION}-curl \
20+
php${DW_PHP_VERSION}-json \
21+
php${DW_PHP_VERSION}-zip
22+
update-alternatives --set php /usr/bin/php${DW_PHP_VERSION}
23+
apt-get clean -y
24+
25+
mkdir -p /phpapp
26+
27+
# enable custom php configuration
28+
phpenmod custom
29+
30+
# enable custom opcache config
31+
phpenmod opcache_settings
32+
33+
# configure php for docker
34+
sed -e 's#^\(error_log\).*#\1 = /dev/stderr#' \
35+
-e 's#^;\(daemonize\).*#\1 = no#' \
36+
-i /etc/php/${DW_PHP_VERSION}/fpm/php-fpm.conf
37+
sed -e 's#^;\(access.log\).*#\1 = /dev/stderr#' \
38+
-e 's#^\(listen\).*#\1 = 0.0.0.0:9000#' \
39+
-e 's#^;\(catch_workers_output\).*#\1 = yes#' \
40+
-e 's#^;\(clear_env\).*#\1 = no#' \
41+
-e 's#^;\(ping\)#\1#g' \
42+
-i /etc/php/${DW_PHP_VERSION}/fpm/pool.d/www.conf
43+
44+
# install developer stuff
45+
./install-development.sh
46+
47+
# gosu
48+
GOSU_VERSION='1.10'
49+
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"
50+
curl -L -o /usr/local/bin/gosu \
51+
"https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"
52+
chmod +x /usr/local/bin/gosu
53+
54+
# phphealth
55+
PHP_HEALTH_VERSION='0.0.1'
56+
curl -L -o /usr/local/bin/php-health.phar \
57+
"https://github.com/dockerwest/php-health/releases/download/$PHP_HEALTH_VERSION/php-health.phar"
58+
chmod +x /usr/local/bin/php-health.phar
59+
60+
# update permissions to allow rootless operation
61+
/usr/local/bin/permissions

7.4/scripts/prepare.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
if [[ 0 = "$UID" ]]; then
4+
if [[ ! -z $C_GID ]]; then
5+
groupmod -g $C_GID www-data
6+
fi
7+
8+
if [[ ! -z $C_UID ]]; then
9+
usermod -u $C_UID www-data
10+
fi
11+
12+
chown www-data:www-data /run/php
13+
14+
chown www-data:www-data /var/www
15+
16+
chown www-data:www-data /phpapp
17+
fi
18+
19+
if [[ "1" == "$DEVELOPMENT" ]]; then
20+
if [[ 0 = "$UID" ]] && [[ ! -z $PHP_EXTRA_MODULES ]]; then
21+
/usr/local/bin/extensions -i $PHP_EXTRA_MODULES
22+
fi
23+
24+
sed -e 's/^\(opcache\.validate_timestamps=\).*/\11/g' \
25+
-i /etc/php/${DW_PHP_VERSION}/mods-available/opcache_settings.ini
26+
27+
phpenmod development > /dev/null 2>&1
28+
phpenmod xdebug > /dev/null 2>&1
29+
30+
ln -s /usr/local/lib/composer /usr/local/bin/composer
31+
fi
32+
33+
if [[ "xdebug" == "$PROFILER" ]]; then
34+
[[ 0 = "$UID" ]] && chown www-data:www-data /xdebug
35+
phpenmod xdebug > /dev/null 2>&1
36+
phpenmod xdebug_profiler > /dev/null 2>&1
37+
elif [[ "xhprof" == "$PROFILER" ]]; then
38+
[[ 0 = "$UID" ]] && chown www-data:www-data /xhprof
39+
phpenmod xhprof > /dev/null 2>&1
40+
elif [[ "tideways" == "$PROFILER" ]]; then
41+
phpenmod tideways > /dev/null 2>&1
42+
elif [[ "blackfire" == "$PROFILER" ]]; then
43+
phpenmod blackfire > /dev/null 2>&1
44+
fi

0 commit comments

Comments
 (0)