Skip to content

Commit 7fd241a

Browse files
committed
Replace PHP-FPM entrypoint
Now we can rely on correct signal handling via dumb-init and only use shush when there's actually encrypted variables
1 parent 2ceda76 commit 7fd241a

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Dockerfile-fpm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ RUN install-shush && rm -f /usr/local/bin/install-shush \
4040

4141
STOPSIGNAL SIGTERM
4242

43-
CMD ["/usr/local/bin/shush", "exec", "php-fpm", "--force-stderr"]
43+
ENTRYPOINT [ "docker-php-entrypoint-init" ]
44+
CMD ["--force-stderr"]
4445

4546
# Base images don't need healthcheck since they are not running applications
4647
# this can be overriden in the child images
@@ -54,6 +55,3 @@ FROM fpm as fpm-dev
5455
# Install Xdebug and development specific configuration
5556
RUN docker-php-dev-mode xdebug \
5657
&& docker-php-dev-mode config
57-
58-
# Change entrypoint back to the default because we don't need shush in development
59-
CMD ["docker-php-entrypoint", "--force-stderr"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# first arg is `-f` or `--some-option` or if it's empty
5+
if [ -z "$1" ] || [ "${1#-}" != "$1" ]; then
6+
set -- php-fpm "$@"
7+
fi
8+
9+
if [ "$1" = php-fpm ]; then
10+
if env | grep -E "^KMS_ENCRYPTED"; then
11+
set -- shush exec -- "$@"
12+
fi
13+
14+
# Rewrite SIGINT to SIGQUIT
15+
# Rewrite SIGTERM to SIGQUIT
16+
# Rewrite SIGHUP to SIGUSR2
17+
set -- dumb-init --rewrite 2:3 --rewrite 15:3 --rewrite 1:17 -- "$@"
18+
fi
19+
20+
exec "$@"

0 commit comments

Comments
 (0)