commit f36a40825ae1cb1c0488955a5a14ed241b5991d1 Author: Nicolas MASSE Date: Wed Mar 31 12:55:32 2021 +0200 Work in Progress diff --git a/apache/Dockerfile b/apache/Dockerfile new file mode 100644 index 0000000..07d17d3 --- /dev/null +++ b/apache/Dockerfile @@ -0,0 +1,15 @@ +#FROM registry.redhat.io/rhel8/httpd-24 +FROM centos/httpd-24-centos7 + +# Add application sources to a directory where the assemble script expects them +# and set permissions so that the container runs without the root access +USER 0 +ADD local.conf /etc/httpd/conf.d/ +USER 1001 + +# Let the assemble script install the dependencies +#RUN /usr/libexec/s2i/assemble + +# The run script uses standard ways to run the application +CMD /usr/libexec/s2i/run + diff --git a/apache/local.conf b/apache/local.conf new file mode 100644 index 0000000..f980029 --- /dev/null +++ b/apache/local.conf @@ -0,0 +1,5 @@ +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so + + ProxyPassMatch ^/info$ fcgi://sample-php-fpm.dns.podman:9000/opt/app-root/src/index.php + diff --git a/apache/run.sh b/apache/run.sh new file mode 100755 index 0000000..5ec9700 --- /dev/null +++ b/apache/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -Eeuo pipefail + +podman build -t sample-apache . +podman run --rm --name sample-apache sample-apache + diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile new file mode 100644 index 0000000..e231cbf --- /dev/null +++ b/php-fpm/Dockerfile @@ -0,0 +1,6 @@ +FROM ubi8/php-74 +ADD src . +USER 0 +RUN mkdir -p /run/php-fpm && chown 1001:0 /run/php-fpm +USER 1001 +CMD /usr/libexec/s2i/run diff --git a/php-fpm/run.sh b/php-fpm/run.sh new file mode 100755 index 0000000..ba0785f --- /dev/null +++ b/php-fpm/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -Eeuo pipefail + +podman build -t sample-php-fpm . +podman run --rm --name sample-php-fpm sample-php-fpm + diff --git a/php-fpm/src/index.php b/php-fpm/src/index.php new file mode 100644 index 0000000..a4d275d --- /dev/null +++ b/php-fpm/src/index.php @@ -0,0 +1,6 @@ + diff --git a/php-fpm/src/php-pre-start/php-fpm.sh b/php-fpm/src/php-pre-start/php-fpm.sh new file mode 100755 index 0000000..df06e1f --- /dev/null +++ b/php-fpm/src/php-pre-start/php-fpm.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Listen on port 9000 +echo "Opening port 9000..." +sed -i 's/^listen *= *.*/listen = 0.0.0.0:9000/' /etc/php-fpm.d/www.conf +sed -i 's/^listen.allowed_clients *= *.*/listen.allowed_clients = /' /etc/php-fpm.d/www.conf + +# Start PHP-FPM +exec /usr/sbin/php-fpm --nodaemonize -d error_log=/dev/fd/2 -d log_level=debug +