From fde5fd0214552a9ce963b06fad0e6055faa80b72 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Sat, 29 Oct 2022 16:19:59 +0700 Subject: [PATCH 01/16] feat: build image for symfony development --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index af15b7c..23bf256 100755 --- a/build +++ b/build @@ -1,7 +1,7 @@ #!/usr/bin/env bash TAGS=("php7.2" "php7.4" "php8.0" "php8.1") -IMAGE="pnlinh/laravel" +IMAGE="pnlinh/symfony" # shellcheck disable=SC2199 # shellcheck disable=SC2076 From d341f55f7c4c04bf03c007a05409e793e922e633 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Sat, 29 Oct 2022 16:19:59 +0700 Subject: [PATCH 02/16] feat: build image for symfony development --- README.md | 28 ++++++++++++---------------- build | 2 +- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index cdf0dd4..6955233 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Docker PHP-FPM & Nginx base on Alpine Linux -Simple docker image for PHP/Laravel development +Simple docker image for Symfony development - Magento: https://github.com/pnlinh/docker-php/tree/feature/magento -- Symfony: Todo +- PHP/Laravel: https://github.com/pnlinh/docker-php ### How to use @@ -19,9 +19,7 @@ Simple docker image for PHP/Laravel development - Mount your code to be served with container ```shell -docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/laravel:php7.4 -docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/laravel:php8.0 -docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/laravel:php8.1 +docker run --name=app -v /path/to/project:/var/www/html -p 80:80 pnlinh/symfony:php8.1 ``` - With docker-compose @@ -31,26 +29,24 @@ version: '3.4' services: app: - image: pnlinh/laravel:php7.4 - hostname: laravel-app - container_name: laravel-app + image: pnlinh/symfony:php8.1 + hostname: symfony-app + container_name: symfony-app ports: - "80:80" volumes: - .:/var/www/html networks: - localnet + +networks: + localnet: + driver: "bridge" ``` -- See PHP version info +- Browser to: [http://localhost](http://localhost) -```shell -docker run --name=app --rm -p 80:80 pnlinh/laravel:php7.4 -docker run --name=app --rm -p 80:80 pnlinh/laravel:php8.0 -docker run --name=app --rm -p 80:80 pnlinh/laravel:php8.1 -``` - -![image](https://user-images.githubusercontent.com/26193890/164198187-743e3585-1379-4d06-a2d5-34330b17d060.png) +![image](https://user-images.githubusercontent.com/26193890/198827932-7901d969-cf9c-4f2a-8154-e2b1fb4840f8.png) ### References diff --git a/build b/build index af15b7c..23bf256 100755 --- a/build +++ b/build @@ -1,7 +1,7 @@ #!/usr/bin/env bash TAGS=("php7.2" "php7.4" "php8.0" "php8.1") -IMAGE="pnlinh/laravel" +IMAGE="pnlinh/symfony" # shellcheck disable=SC2199 # shellcheck disable=SC2076 From 6e110fc62461358a6354f7edebe33b197ca61953 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Sat, 29 Oct 2022 22:33:27 +0700 Subject: [PATCH 03/16] feat: enable opcache --- config/81/php.ini | 8 ++++++++ php8.1.Dockerfile | 1 + 2 files changed, 9 insertions(+) diff --git a/config/81/php.ini b/config/81/php.ini index 92e7ad3..c765813 100644 --- a/config/81/php.ini +++ b/config/81/php.ini @@ -16,3 +16,11 @@ post_max_size = 20M max_execution_time=600 default_socket_timeout=3600 request_terminate_timeout=600 + +; Opcache settings. +opcache.memory_consumption=128 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4000 +opcache.revalidate_freq=60 +opcache.fast_shutdown=1 +opcache.enable_cli=1 diff --git a/php8.1.Dockerfile b/php8.1.Dockerfile index a59ff79..42b4b96 100644 --- a/php8.1.Dockerfile +++ b/php8.1.Dockerfile @@ -37,6 +37,7 @@ RUN apk add --no-cache \ php81-pecl-apcu \ php81-common \ php81-sqlite3 \ + php81-opcache \ curl \ nginx \ vim \ From ec909d66c595cd5fb9ad177d3bd9310966ab9936 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 31 Oct 2022 14:49:52 +0700 Subject: [PATCH 04/16] feat: add locally trusted development certificates --- config/81/etc/nginx/ssl/localhost-key.pem | 28 +++++++++++++++++++++++ config/81/etc/nginx/ssl/localhost.pem | 27 ++++++++++++++++++++++ config/81/nginx.conf | 4 ++++ php8.1.Dockerfile | 5 +++- 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 config/81/etc/nginx/ssl/localhost-key.pem create mode 100644 config/81/etc/nginx/ssl/localhost.pem diff --git a/config/81/etc/nginx/ssl/localhost-key.pem b/config/81/etc/nginx/ssl/localhost-key.pem new file mode 100644 index 0000000..3336335 --- /dev/null +++ b/config/81/etc/nginx/ssl/localhost-key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC/FhKkB4Sc39bO +heEz0eDKa/fHWfYZen4Q+prTi1EvSvWuEAkmrVHXiwwwmTgfHs013TNTYhYAULAc +aeu3lWS6daAZl43MCJipbrDPjiLWmSWn0T49fpvHRDmSrRmcS7wF1BPlpipDdDv2 +NEofHWswM7pgybSLeuVtTqZnyG6fOJQbYpCf07psTgrQYXdyn38IJ6M+HwiIwmWl +BaL6Zczn4E944Nt4UpyF6nvtOG7rrxH2zA269pGZgswyVYEAOWX6gQY+yhSchlEz +7hPPHBn5IKhs/TE1/fEUjaXVhyjnVNw1u0ioO6ladgx3IhJ25N+82xCcsTCJ25/+ +9a8r68hFAgMBAAECggEBAJq9NiUsjWA4B4xAcCj1iZKCMil2GUtynUoEloI+bGTe +z+q/w5lVe1QPnrRwLzlMSSOYWCrq4CQrMyIfSCnnSaWRATAYQVR7lZyHLZk2YdHk +PNEUKdHEiEOqZPD5Sib+UWlq3x32HH15T+FFYMynlxh2mzQrww+8WrPUn/6lGafG +0c1e4mezUnNWxFygqcSM4ApLLth2qL2jKMLcLHcODYhRUXaZoYyBtC6zQHwoyfPH +wv5xfVpu0KFzB2Ro/Wn57WocSG/OU7lViyyiXEvk2p73QcbpjNow9f0dCnKrn3zQ +q7tB0WnmRLFB/pxPWd09sbEIn8/s5UCh1sVMoAhyzoECgYEAxOOSfGnqDwmQxE5J +xlaLLENGgTU0AnJ14I04qs+XPexi4f3TfFLFRri9w3RrAQ78ujyRt6A2YPa4igIt +H83WYrE4f6TxP6lh3USEWbOGbFt1vtQbfMZ9ekAwEtWce5/fr9phCHm04xNaUg1Q +syqC2aHX1vV3mqwAwf/4wHvGTWUCgYEA+HSEHu0UpLEnHnva+AbvE5PSMDkefyz5 +yUa4q2pxnLQ/weL6ncXAbLyAdagN6sFaMesIMdcQOtKEhc9Qk56RHH6wMJpnIlB4 +dxu9jxG5aO1IqMP3MhcOC2UowG+NR3P17PCNdgLVrZ3IVNay/xTaswhZG4p2ZHgX +2gLPst0l0WECgYAujPvKbKRJT+KpdzUcLsQTAAkAbZrRZUyXfexC/nfszSIH+qJx +B4TbFrzPJIxUIL4CLmXpe3i/7jVtc9xFY75ncS1BiLb9bUfVL+j26GpE3k71gmLJ +Woi6ScjT+ytXU1Jo2oIMpfHtqlq1ga5t3gQ3/nrwuPLBYB+BvsqKf/k/vQKBgQDY +V0y8SSBSj9dKWfq/Qfpnh63cQ8BkaNtQAf7HdDZdhy6FO4mSXCFEDZel26HSqm5J +TSijjWsabTjr8ytsfwRIVaBBkhD/9iYPQN58d6iEzykXmxviR+T40yr69aeFclnP +6V6kRa+eL+fCx/iw2I3emwRMUPLqZRAPy6bjTmGhwQKBgQCHhQea2UDBqylMYf5i +wdnUaH2R9QLA1jdfJEQEUMQyC3mQYb1xN1Sf6gqec0mnGKm7UlguofaPNTECtHFj +Ad07DCgcNiwePpU+0SXpuNi9ghOMPEnNwwkd5v2VmiHhqmVulZ7vCrqQ+jgv/xPm +QLJjsRZgFNU2jPTHd2uCDPjuIA== +-----END PRIVATE KEY----- diff --git a/config/81/etc/nginx/ssl/localhost.pem b/config/81/etc/nginx/ssl/localhost.pem new file mode 100644 index 0000000..0af9cd6 --- /dev/null +++ b/config/81/etc/nginx/ssl/localhost.pem @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEjzCCAvegAwIBAgIQab/3kDHPzJMRlMzexgesTjANBgkqhkiG9w0BAQsFADCB +qzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMUAwPgYDVQQLDDdwbmxp +bmhAcG5saW5ocy1NQlAucm91dGVycy5zYXJpdGFzYS5pbyAoTmdvYyBMaW5oIFBo +YW0pMUcwRQYDVQQDDD5ta2NlcnQgcG5saW5oQHBubGluaHMtTUJQLnJvdXRlcnMu +c2FyaXRhc2EuaW8gKE5nb2MgTGluaCBQaGFtKTAeFw0yMjEwMzEwNjM2MTJaFw0y +NTAxMzEwNjM2MTJaMGsxJzAlBgNVBAoTHm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0 +aWZpY2F0ZTFAMD4GA1UECww3cG5saW5oQHBubGluaHMtTUJQLnJvdXRlcnMuc2Fy +aXRhc2EuaW8gKE5nb2MgTGluaCBQaGFtKTCCASIwDQYJKoZIhvcNAQEBBQADggEP +ADCCAQoCggEBAL8WEqQHhJzf1s6F4TPR4Mpr98dZ9hl6fhD6mtOLUS9K9a4QCSat +UdeLDDCZOB8ezTXdM1NiFgBQsBxp67eVZLp1oBmXjcwImKlusM+OItaZJafRPj1+ +m8dEOZKtGZxLvAXUE+WmKkN0O/Y0Sh8dazAzumDJtIt65W1OpmfIbp84lBtikJ/T +umxOCtBhd3Kffwgnoz4fCIjCZaUFovplzOfgT3jg23hSnIXqe+04buuvEfbMDbr2 +kZmCzDJVgQA5ZfqBBj7KFJyGUTPuE88cGfkgqGz9MTX98RSNpdWHKOdU3DW7SKg7 +qVp2DHciEnbk37zbEJyxMInbn/71ryvryEUCAwEAAaNuMGwwDgYDVR0PAQH/BAQD +AgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDATAfBgNVHSMEGDAWgBR9 +z90bVj1kY4IDNXegq0gMvGMXtzAaBgNVHREEEzARgglsb2NhbGhvc3SHBH8AAAEw +DQYJKoZIhvcNAQELBQADggGBAHAXRQo4gdWiaX0nv3jvOJF1APb/GqUL3DIv2EgZ +QuX7hBddZN/M3m4HUVtpj4E0iMlUL+2jZZ2wiC03wTfLeTthv0wnu0zr+PFpsFoX +coCrUKIhm5xU09K5uTxULkSaWzEg3iGBGY6ZmZR4IKRYfhfnWbMciEPUC03SpAgF +x71b0MRcnpoJnjGAh+lSkGqkDROx38KixaFo1+C09a5Nb/7F1VCaj6R/N3yJChUC +bPPnmZKozfz+RClJAQlmtsGh4Ph8bUtj2vK+mcHgHP9KJPSbTY0XJRy0SRVkBV4e +wahLhxh8mRdpu8v5KVGILIQSxlRcTtYZc4eda+7lyCO7UZadfs4TrhHAXakiDgjO +ET04sZCtkZbEukNGhYVU30cQXFq0sS4hmoTxL4CcrtBmDj0UQ7bQSkpAwsnKeT59 +QZgx8FSHZMxIYAGCILx6oIq22U8xx1BZ9xOTBm7OIkMcjfKQznbbSiCbTsQH0UJz +aB702H3LDBCBzi370+S9vWpeAw== +-----END CERTIFICATE----- diff --git a/config/81/nginx.conf b/config/81/nginx.conf index c45c414..5b4606a 100644 --- a/config/81/nginx.conf +++ b/config/81/nginx.conf @@ -33,6 +33,10 @@ http { server { listen [::]:80 default_server; listen 80 default_server; + listen 443 ssl http2; + listen [::]:443 ssl http2; + ssl_certificate /etc/nginx/ssl/localhost.pem; + ssl_certificate_key /etc/nginx/ssl/localhost-key.pem; server_name _; sendfile off; diff --git a/php8.1.Dockerfile b/php8.1.Dockerfile index 42b4b96..2232e9c 100644 --- a/php8.1.Dockerfile +++ b/php8.1.Dockerfile @@ -81,8 +81,11 @@ USER www # Add application COPY --chown=www src/ /var/www/html/public +# SSL config +COPY --chown=www config/81/etc/nginx/ssl /etc/nginx/ssl + # Expose the port nginx is reachable on -EXPOSE 80 +EXPOSE 80 443 # Let supervisord start nginx & php-fpm CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] From d22fa9c6ab3128c0eac02f579ffc30be261483a1 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Tue, 1 Nov 2022 14:00:22 +0700 Subject: [PATCH 05/16] chore: disable opcache --- config/81/php.ini | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/81/php.ini b/config/81/php.ini index c765813..92e7ad3 100644 --- a/config/81/php.ini +++ b/config/81/php.ini @@ -16,11 +16,3 @@ post_max_size = 20M max_execution_time=600 default_socket_timeout=3600 request_terminate_timeout=600 - -; Opcache settings. -opcache.memory_consumption=128 -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=4000 -opcache.revalidate_freq=60 -opcache.fast_shutdown=1 -opcache.enable_cli=1 From 37b48738d207ea4e760978c4e6192d629b0dd603 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Tue, 1 Nov 2022 15:53:31 +0700 Subject: [PATCH 06/16] feat: add php8.1 intl extension --- php8.1.Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/php8.1.Dockerfile b/php8.1.Dockerfile index 2232e9c..0049706 100644 --- a/php8.1.Dockerfile +++ b/php8.1.Dockerfile @@ -38,6 +38,7 @@ RUN apk add --no-cache \ php81-common \ php81-sqlite3 \ php81-opcache \ + php81-intl \ curl \ nginx \ vim \ From 7f1f131c3e7882462225c9f0dcb1d7263af9a977 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Wed, 2 Nov 2022 09:29:42 +0700 Subject: [PATCH 07/16] chore: update dockerfile --- php8.1.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php8.1.Dockerfile b/php8.1.Dockerfile index 0049706..59b1ae6 100644 --- a/php8.1.Dockerfile +++ b/php8.1.Dockerfile @@ -52,7 +52,7 @@ RUN apk add --no-cache \ RUN cp /usr/bin/php81 /usr/bin/php # Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +COPY --from=composer/composer:2-bin /composer /usr/bin/composer # Configure nginx COPY config/81/nginx.conf /etc/nginx/nginx.conf From 0e6063a622d5079988e45f8c703490132809b61e Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Wed, 2 Nov 2022 21:03:16 +0700 Subject: [PATCH 08/16] chore: migrate to use runit instead of supervisord --- config/72/boot.sh | 39 +++++++++++++++++ config/72/fpm-pool.conf | 6 ++- config/72/nginx.conf | 6 +-- config/72/nginx.run | 5 +++ config/72/php.run | 5 +++ config/72/supervisord.conf | 23 ---------- config/74/boot.sh | 39 +++++++++++++++++ config/74/fpm-pool.conf | 2 +- config/74/nginx.conf | 6 +-- config/74/nginx.run | 5 +++ config/74/php.run | 5 +++ config/74/supervisord.conf | 23 ---------- config/80/boot.sh | 39 +++++++++++++++++ config/80/fpm-pool.conf | 6 ++- config/80/nginx.conf | 8 ++-- config/80/nginx.run | 5 +++ config/80/php.run | 5 +++ config/80/supervisord.conf | 23 ---------- config/81/boot.sh | 39 +++++++++++++++++ config/81/fpm-pool.conf | 6 ++- config/81/nginx.conf | 8 ++-- config/81/nginx.run | 5 +++ config/81/php.run | 5 +++ config/81/supervisord.conf | 23 ---------- php7.2.Dockerfile | 81 ++++++++++++++++++----------------- php7.4.Dockerfile | 82 ++++++++++++++++++------------------ php8.0.Dockerfile | 86 +++++++++++++++++++------------------- php8.1.Dockerfile | 84 ++++++++++++++++++------------------- 28 files changed, 388 insertions(+), 281 deletions(-) create mode 100644 config/72/boot.sh create mode 100644 config/72/nginx.run create mode 100644 config/72/php.run delete mode 100644 config/72/supervisord.conf create mode 100644 config/74/boot.sh create mode 100644 config/74/nginx.run create mode 100644 config/74/php.run delete mode 100644 config/74/supervisord.conf create mode 100644 config/80/boot.sh create mode 100644 config/80/nginx.run create mode 100644 config/80/php.run delete mode 100644 config/80/supervisord.conf create mode 100644 config/81/boot.sh create mode 100644 config/81/nginx.run create mode 100644 config/81/php.run delete mode 100644 config/81/supervisord.conf diff --git a/config/72/boot.sh b/config/72/boot.sh new file mode 100644 index 0000000..835a26d --- /dev/null +++ b/config/72/boot.sh @@ -0,0 +1,39 @@ +#!/bin/sh +shutdown() { + echo "shutting down container" + + # first shutdown any service started by runit + for _srv in $(ls -1 /etc/service); do + sv force-stop ${_srv} + done + + # shutdown runsvdir command + kill -HUP ${PID} + wait ${PID} + + # give processes time to stop + sleep 0.5 + + # kill any other processes still running in the container + for _pid in $(ps -eo pid | grep -v PID | tr -d ' ' | grep -v '^1$' | head -n -6); do + timeout -t 5 /bin/sh -c "kill $_pid && wait $_pid || kill -9 $_pid" + done + exit +} + +exec env - PATH=$PATH runsvdir -P /etc/service & + +PID=$! +echo "Started runsvdir, PID is $PID" +echo "wait for processes to start...." + +sleep 5 +for _srv in $(ls -1 /etc/service); do + sv status ${_srv} +done + +# catch shutdown signals +trap shutdown SIGTERM SIGHUP SIGQUIT SIGINT +wait ${PID} + +shutdown \ No newline at end of file diff --git a/config/72/fpm-pool.conf b/config/72/fpm-pool.conf index 303b3cf..4cfa684 100644 --- a/config/72/fpm-pool.conf +++ b/config/72/fpm-pool.conf @@ -3,6 +3,10 @@ error_log = /dev/stderr [www] + +user = www +group = www + ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on @@ -13,7 +17,7 @@ error_log = /dev/stderr ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /run/php-fpm.sock +listen = 127.0.0.1:9000 ; Enable status page pm.status_path = /fpm-status diff --git a/config/72/nginx.conf b/config/72/nginx.conf index 43b6811..a37c773 100644 --- a/config/72/nginx.conf +++ b/config/72/nginx.conf @@ -54,11 +54,11 @@ http { root /var/lib/nginx/html; } - # Pass the PHP scripts to PHP-FPM listening on php-fpm.sock + # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; @@ -82,7 +82,7 @@ http { deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; } } diff --git a/config/72/nginx.run b/config/72/nginx.run new file mode 100644 index 0000000..b6babfa --- /dev/null +++ b/config/72/nginx.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run nginx +exec 2>&1 +exec nginx -g 'daemon off;' \ No newline at end of file diff --git a/config/72/php.run b/config/72/php.run new file mode 100644 index 0000000..95c8f15 --- /dev/null +++ b/config/72/php.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run php-fpm +exec 2>&1 +exec php-fpm7 -F diff --git a/config/72/supervisord.conf b/config/72/supervisord.conf deleted file mode 100644 index edd5207..0000000 --- a/config/72/supervisord.conf +++ /dev/null @@ -1,23 +0,0 @@ -[supervisord] -nodaemon=true -logfile=/dev/null -logfile_maxbytes=0 -pidfile=/run/supervisord.pid - -[program:php-fpm] -command=php-fpm7 -F -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 - -[program:nginx] -command=nginx -g 'daemon off;' -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 diff --git a/config/74/boot.sh b/config/74/boot.sh new file mode 100644 index 0000000..835a26d --- /dev/null +++ b/config/74/boot.sh @@ -0,0 +1,39 @@ +#!/bin/sh +shutdown() { + echo "shutting down container" + + # first shutdown any service started by runit + for _srv in $(ls -1 /etc/service); do + sv force-stop ${_srv} + done + + # shutdown runsvdir command + kill -HUP ${PID} + wait ${PID} + + # give processes time to stop + sleep 0.5 + + # kill any other processes still running in the container + for _pid in $(ps -eo pid | grep -v PID | tr -d ' ' | grep -v '^1$' | head -n -6); do + timeout -t 5 /bin/sh -c "kill $_pid && wait $_pid || kill -9 $_pid" + done + exit +} + +exec env - PATH=$PATH runsvdir -P /etc/service & + +PID=$! +echo "Started runsvdir, PID is $PID" +echo "wait for processes to start...." + +sleep 5 +for _srv in $(ls -1 /etc/service); do + sv status ${_srv} +done + +# catch shutdown signals +trap shutdown SIGTERM SIGHUP SIGQUIT SIGINT +wait ${PID} + +shutdown \ No newline at end of file diff --git a/config/74/fpm-pool.conf b/config/74/fpm-pool.conf index eed0323..a37cbdf 100644 --- a/config/74/fpm-pool.conf +++ b/config/74/fpm-pool.conf @@ -17,7 +17,7 @@ group = www ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /run/php-fpm.sock +listen = 127.0.0.1:9000 ; Enable status page pm.status_path = /fpm-status diff --git a/config/74/nginx.conf b/config/74/nginx.conf index 43b6811..a37c773 100644 --- a/config/74/nginx.conf +++ b/config/74/nginx.conf @@ -54,11 +54,11 @@ http { root /var/lib/nginx/html; } - # Pass the PHP scripts to PHP-FPM listening on php-fpm.sock + # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; @@ -82,7 +82,7 @@ http { deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; } } diff --git a/config/74/nginx.run b/config/74/nginx.run new file mode 100644 index 0000000..b6babfa --- /dev/null +++ b/config/74/nginx.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run nginx +exec 2>&1 +exec nginx -g 'daemon off;' \ No newline at end of file diff --git a/config/74/php.run b/config/74/php.run new file mode 100644 index 0000000..95c8f15 --- /dev/null +++ b/config/74/php.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run php-fpm +exec 2>&1 +exec php-fpm7 -F diff --git a/config/74/supervisord.conf b/config/74/supervisord.conf deleted file mode 100644 index edd5207..0000000 --- a/config/74/supervisord.conf +++ /dev/null @@ -1,23 +0,0 @@ -[supervisord] -nodaemon=true -logfile=/dev/null -logfile_maxbytes=0 -pidfile=/run/supervisord.pid - -[program:php-fpm] -command=php-fpm7 -F -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 - -[program:nginx] -command=nginx -g 'daemon off;' -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 diff --git a/config/80/boot.sh b/config/80/boot.sh new file mode 100644 index 0000000..835a26d --- /dev/null +++ b/config/80/boot.sh @@ -0,0 +1,39 @@ +#!/bin/sh +shutdown() { + echo "shutting down container" + + # first shutdown any service started by runit + for _srv in $(ls -1 /etc/service); do + sv force-stop ${_srv} + done + + # shutdown runsvdir command + kill -HUP ${PID} + wait ${PID} + + # give processes time to stop + sleep 0.5 + + # kill any other processes still running in the container + for _pid in $(ps -eo pid | grep -v PID | tr -d ' ' | grep -v '^1$' | head -n -6); do + timeout -t 5 /bin/sh -c "kill $_pid && wait $_pid || kill -9 $_pid" + done + exit +} + +exec env - PATH=$PATH runsvdir -P /etc/service & + +PID=$! +echo "Started runsvdir, PID is $PID" +echo "wait for processes to start...." + +sleep 5 +for _srv in $(ls -1 /etc/service); do + sv status ${_srv} +done + +# catch shutdown signals +trap shutdown SIGTERM SIGHUP SIGQUIT SIGINT +wait ${PID} + +shutdown \ No newline at end of file diff --git a/config/80/fpm-pool.conf b/config/80/fpm-pool.conf index 4be2061..a37cbdf 100644 --- a/config/80/fpm-pool.conf +++ b/config/80/fpm-pool.conf @@ -3,6 +3,10 @@ error_log = /dev/stderr [www] + +user = www +group = www + ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on @@ -13,7 +17,7 @@ error_log = /dev/stderr ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /run/php-fpm.sock +listen = 127.0.0.1:9000 ; Enable status page pm.status_path = /fpm-status diff --git a/config/80/nginx.conf b/config/80/nginx.conf index c45c414..a37c773 100644 --- a/config/80/nginx.conf +++ b/config/80/nginx.conf @@ -20,7 +20,7 @@ http { access_log /dev/stdout main_timed; error_log /dev/stderr notice; - keepalive_timeout 65; + keepalive_timeout 3000; # Write temporary files to /tmp so they can be created as a non-privileged user client_body_temp_path /tmp/client_temp; @@ -54,11 +54,11 @@ http { root /var/lib/nginx/html; } - # Pass the PHP scripts to PHP-FPM listening on php-fpm.sock + # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; @@ -82,7 +82,7 @@ http { deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; } } diff --git a/config/80/nginx.run b/config/80/nginx.run new file mode 100644 index 0000000..b6babfa --- /dev/null +++ b/config/80/nginx.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run nginx +exec 2>&1 +exec nginx -g 'daemon off;' \ No newline at end of file diff --git a/config/80/php.run b/config/80/php.run new file mode 100644 index 0000000..6fa4ca5 --- /dev/null +++ b/config/80/php.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run php-fpm +exec 2>&1 +exec php-fpm8 -F diff --git a/config/80/supervisord.conf b/config/80/supervisord.conf deleted file mode 100644 index 216a387..0000000 --- a/config/80/supervisord.conf +++ /dev/null @@ -1,23 +0,0 @@ -[supervisord] -nodaemon=true -logfile=/dev/null -logfile_maxbytes=0 -pidfile=/run/supervisord.pid - -[program:php-fpm] -command=php-fpm8 -F -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 - -[program:nginx] -command=nginx -g 'daemon off;' -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 diff --git a/config/81/boot.sh b/config/81/boot.sh new file mode 100644 index 0000000..835a26d --- /dev/null +++ b/config/81/boot.sh @@ -0,0 +1,39 @@ +#!/bin/sh +shutdown() { + echo "shutting down container" + + # first shutdown any service started by runit + for _srv in $(ls -1 /etc/service); do + sv force-stop ${_srv} + done + + # shutdown runsvdir command + kill -HUP ${PID} + wait ${PID} + + # give processes time to stop + sleep 0.5 + + # kill any other processes still running in the container + for _pid in $(ps -eo pid | grep -v PID | tr -d ' ' | grep -v '^1$' | head -n -6); do + timeout -t 5 /bin/sh -c "kill $_pid && wait $_pid || kill -9 $_pid" + done + exit +} + +exec env - PATH=$PATH runsvdir -P /etc/service & + +PID=$! +echo "Started runsvdir, PID is $PID" +echo "wait for processes to start...." + +sleep 5 +for _srv in $(ls -1 /etc/service); do + sv status ${_srv} +done + +# catch shutdown signals +trap shutdown SIGTERM SIGHUP SIGQUIT SIGINT +wait ${PID} + +shutdown \ No newline at end of file diff --git a/config/81/fpm-pool.conf b/config/81/fpm-pool.conf index 4be2061..a37cbdf 100644 --- a/config/81/fpm-pool.conf +++ b/config/81/fpm-pool.conf @@ -3,6 +3,10 @@ error_log = /dev/stderr [www] + +user = www +group = www + ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on @@ -13,7 +17,7 @@ error_log = /dev/stderr ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /run/php-fpm.sock +listen = 127.0.0.1:9000 ; Enable status page pm.status_path = /fpm-status diff --git a/config/81/nginx.conf b/config/81/nginx.conf index 5b4606a..5d13cc1 100644 --- a/config/81/nginx.conf +++ b/config/81/nginx.conf @@ -20,7 +20,7 @@ http { access_log /dev/stdout main_timed; error_log /dev/stderr notice; - keepalive_timeout 65; + keepalive_timeout 3000; # Write temporary files to /tmp so they can be created as a non-privileged user client_body_temp_path /tmp/client_temp; @@ -58,11 +58,11 @@ http { root /var/lib/nginx/html; } - # Pass the PHP scripts to PHP-FPM listening on php-fpm.sock + # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; @@ -86,7 +86,7 @@ http { deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; - fastcgi_pass unix:/run/php-fpm.sock; + fastcgi_pass 127.0.0.1:9000; } } diff --git a/config/81/nginx.run b/config/81/nginx.run new file mode 100644 index 0000000..b6babfa --- /dev/null +++ b/config/81/nginx.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run nginx +exec 2>&1 +exec nginx -g 'daemon off;' \ No newline at end of file diff --git a/config/81/php.run b/config/81/php.run new file mode 100644 index 0000000..a54a984 --- /dev/null +++ b/config/81/php.run @@ -0,0 +1,5 @@ +#!/bin/sh -e + +# pipe stderr to stdout and run php-fpm +exec 2>&1 +exec php-fpm81 -F \ No newline at end of file diff --git a/config/81/supervisord.conf b/config/81/supervisord.conf deleted file mode 100644 index 77bda1a..0000000 --- a/config/81/supervisord.conf +++ /dev/null @@ -1,23 +0,0 @@ -[supervisord] -nodaemon=true -logfile=/dev/null -logfile_maxbytes=0 -pidfile=/run/supervisord.pid - -[program:php-fpm] -command=php-fpm81 -F -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 - -[program:nginx] -command=nginx -g 'daemon off;' -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 -autorestart=false -startretries=0 diff --git a/php7.2.Dockerfile b/php7.2.Dockerfile index e5bb2db..bfab383 100644 --- a/php7.2.Dockerfile +++ b/php7.2.Dockerfile @@ -8,40 +8,35 @@ WORKDIR /var/www/html # Install packages and remove default server definition RUN apk add --no-cache \ - php7 \ - php7-fpm \ - php7-bcmath \ - php7-ctype \ - php7-fileinfo \ - php7-json \ - php7-mbstring \ - php7-openssl \ - php7-pdo_pgsql \ - php7-curl \ - php7-pdo \ - php7-tokenizer \ - php7-xml \ - php7-phar \ - php7-dom \ - php7-gd \ - php7-iconv \ - php7-xmlwriter \ - php7-xmlreader \ - php7-zip \ - php7-simplexml \ - php7-redis \ - php7-pdo_mysql \ - php7-pdo_pgsql \ - php7-pdo_sqlite \ - php7-soap \ - php7-common \ - php7-sqlite3 \ - curl \ - nginx \ - vim \ - nano \ - supervisor \ - git + php7 \ + php7-fpm \ + php7-bcmath \ + php7-ctype \ + php7-fileinfo \ + php7-json \ + php7-mbstring \ + php7-openssl \ + php7-pdo_pgsql \ + php7-pdo_mysql \ + php7-curl \ + php7-pdo \ + php7-tokenizer \ + php7-xml \ + php7-phar \ + php7-dom \ + php7-gd \ + php7-iconv \ + php7-xmlwriter \ + php7-xmlreader \ + php7-zip \ + php7-simplexml \ + php7-session \ + php7-opcache \ + php7-intl \ + php7-apcu \ + curl \ + nginx \ + runit # Install XDebug @@ -49,7 +44,7 @@ RUN apk add --no-cache \ RUN cp /usr/bin/php7 /usr/bin/php # Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +COPY --from=composer/composer:2-bin /composer /usr/bin/composer # Configure nginx COPY config/72/nginx.conf /etc/nginx/nginx.conf @@ -61,8 +56,8 @@ RUN rm /etc/nginx/conf.d/default.conf COPY config/72/fpm-pool.conf /etc/php7/php-fpm.d/www.conf COPY config/72/php.ini /etc/php7/conf.d/custom.ini -# Configure supervisord -COPY config/72/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +# Configure runit boot script +COPY config/72/boot.sh /sbin/boot.sh # Make sure files/folders needed by the processes are accessable when they run under the www user ARG nginxUID=1000 @@ -76,8 +71,12 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \ chown -R www:www /var/lib/nginx && \ chown -R www:www /var/log/nginx -# Switch to use a www user from here on -USER www +COPY config/72/nginx.run /etc/service/nginx/run +COPY config/72/php.run /etc/service/php/run + +RUN chmod +x /etc/service/nginx/run \ + && chmod +x /etc/service/php/run \ + && ls -al /var/www/html/ # Add application COPY --chown=www src/ /var/www/html/public @@ -85,8 +84,8 @@ COPY --chown=www src/ /var/www/html/public # Expose the port nginx is reachable on EXPOSE 80 -# Let supervisord start nginx & php-fpm -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] +# Let boot start nginx & php-fpm +CMD ["sh", "/sbin/boot.sh"] # Configure a healthcheck to validate that everything is up & running HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping diff --git a/php7.4.Dockerfile b/php7.4.Dockerfile index 82b871f..36484d8 100644 --- a/php7.4.Dockerfile +++ b/php7.4.Dockerfile @@ -8,41 +8,35 @@ WORKDIR /var/www/html # Install packages and remove default server definition RUN apk add --no-cache \ - php7 \ - php7-fpm \ - php7-bcmath \ - php7-ctype \ - php7-fileinfo \ - php7-json \ - php7-mbstring \ - php7-openssl \ - php7-pdo_pgsql \ - php7-curl \ - php7-pdo \ - php7-tokenizer \ - php7-xml \ - php7-phar \ - php7-dom \ - php7-gd \ - php7-iconv \ - php7-xmlwriter \ - php7-xmlreader \ - php7-zip \ - php7-simplexml \ - php7-redis \ - php7-pdo_mysql \ - php7-pdo_pgsql \ - php7-pdo_sqlite \ - php7-soap \ - php7-pecl-apcu \ - php7-common \ - php7-sqlite3 \ - curl \ - nginx \ - vim \ - nano \ - supervisor \ - git + php7 \ + php7-fpm \ + php7-bcmath \ + php7-ctype \ + php7-fileinfo \ + php7-json \ + php7-mbstring \ + php7-openssl \ + php7-pdo_pgsql \ + php7-pdo_mysql \ + php7-curl \ + php7-pdo \ + php7-tokenizer \ + php7-xml \ + php7-phar \ + php7-dom \ + php7-gd \ + php7-iconv \ + php7-xmlwriter \ + php7-xmlreader \ + php7-zip \ + php7-simplexml \ + php7-session \ + php7-opcache \ + php7-intl \ + php7-pecl-apcu \ + curl \ + nginx \ + runit # Install XDebug @@ -50,7 +44,7 @@ RUN apk add --no-cache \ RUN cp /usr/bin/php7 /usr/bin/php # Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +COPY --from=composer/composer:2-bin /composer /usr/bin/composer # Configure nginx COPY config/74/nginx.conf /etc/nginx/nginx.conf @@ -59,8 +53,8 @@ COPY config/74/nginx.conf /etc/nginx/nginx.conf COPY config/74/fpm-pool.conf /etc/php7/php-fpm.d/www.conf COPY config/74/php.ini /etc/php7/conf.d/custom.ini -# Configure supervisord -COPY config/74/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +# Configure runit boot script +COPY config/74/boot.sh /sbin/boot.sh # Make sure files/folders needed by the processes are accessable when they run under the www user ARG nginxUID=1000 @@ -74,8 +68,12 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \ chown -R www:www /var/lib/nginx && \ chown -R www:www /var/log/nginx -# Switch to use a www user from here on -USER www +COPY config/74/nginx.run /etc/service/nginx/run +COPY config/74/php.run /etc/service/php/run + +RUN chmod +x /etc/service/nginx/run \ + && chmod +x /etc/service/php/run \ + && ls -al /var/www/html/ # Add application COPY --chown=www src/ /var/www/html/public @@ -83,8 +81,8 @@ COPY --chown=www src/ /var/www/html/public # Expose the port nginx is reachable on EXPOSE 80 -# Let supervisord start nginx & php-fpm -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] +# Let boot start nginx & php-fpm +CMD ["sh", "/sbin/boot.sh"] # Configure a healthcheck to validate that everything is up & running HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping diff --git a/php8.0.Dockerfile b/php8.0.Dockerfile index a04d164..5a89af2 100644 --- a/php8.0.Dockerfile +++ b/php8.0.Dockerfile @@ -1,48 +1,42 @@ ARG ALPINE_VERSION=3.16 FROM alpine:${ALPINE_VERSION} LABEL Maintainer="Ngoc Linh Pham " -LABEL Description="Lightweight container with Nginx 1.20 & PHP 8.0 based on Alpine Linux." +LABEL Description="Lightweight container with Nginx 1.22 & PHP 8.0 based on Alpine Linux." # Setup document root WORKDIR /var/www/html # Install packages and remove default server definition RUN apk add --no-cache \ - php8 \ - php8-fpm \ - php8-bcmath \ - php8-ctype \ - php8-fileinfo \ - php8-json \ - php8-mbstring \ - php8-openssl \ - php8-pdo_pgsql \ - php8-curl \ - php8-pdo \ - php8-tokenizer \ - php8-xml \ - php8-phar \ - php8-dom \ - php8-gd \ - php8-iconv \ - php8-xmlwriter \ - php8-xmlreader \ - php8-zip \ - php8-simplexml \ - php8-redis \ - php8-pdo_mysql \ - php8-pdo_pgsql \ - php8-pdo_sqlite \ - php8-soap \ - php8-pecl-apcu \ - php8-common \ - php8-sqlite3 \ - curl \ - nginx \ - vim \ - nano \ - supervisor \ - git + php8 \ + php8-fpm \ + php8-bcmath \ + php8-ctype \ + php8-fileinfo \ + php8-json \ + php8-mbstring \ + php8-openssl \ + php8-pdo_pgsql \ + php8-pdo_mysql \ + php8-curl \ + php8-pdo \ + php8-tokenizer \ + php8-xml \ + php8-phar \ + php8-dom \ + php8-gd \ + php8-iconv \ + php8-xmlwriter \ + php8-xmlreader \ + php8-zip \ + php8-simplexml \ + php8-session \ + php8-opcache \ + php8-intl \ + php8-pecl-apcu \ + curl \ + nginx \ + runit # Install XDebug @@ -50,7 +44,7 @@ RUN apk add --no-cache \ RUN cp /usr/bin/php8 /usr/bin/php # Install Composer -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer +COPY --from=composer/composer:2-bin /composer /usr/bin/composer # Configure nginx COPY config/80/nginx.conf /etc/nginx/nginx.conf @@ -59,8 +53,8 @@ COPY config/80/nginx.conf /etc/nginx/nginx.conf COPY config/80/fpm-pool.conf /etc/php8/php-fpm.d/www.conf COPY config/80/php.ini /etc/php8/conf.d/custom.ini -# Configure supervisord -COPY config/80/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +# Configure runit boot script +COPY config/80/boot.sh /sbin/boot.sh # Make sure files/folders needed by the processes are accessable when they run under the www user ARG nginxUID=1000 @@ -74,17 +68,21 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \ chown -R www:www /var/lib/nginx && \ chown -R www:www /var/log/nginx -# Switch to use a www user from here on -USER www +COPY config/80/nginx.run /etc/service/nginx/run +COPY config/80/php.run /etc/service/php/run + +RUN chmod +x /etc/service/nginx/run \ + && chmod +x /etc/service/php/run \ + && ls -al /var/www/html/ # Add application COPY --chown=www src/ /var/www/html/public # Expose the port nginx is reachable on -EXPOSE 80 +EXPOSE 80 443 -# Let supervisord start nginx & php-fpm -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] +# Let boot start nginx & php-fpm +CMD ["sh", "/sbin/boot.sh"] # Configure a healthcheck to validate that everything is up & running HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping diff --git a/php8.1.Dockerfile b/php8.1.Dockerfile index 59b1ae6..7340fe8 100644 --- a/php8.1.Dockerfile +++ b/php8.1.Dockerfile @@ -1,50 +1,42 @@ ARG ALPINE_VERSION=3.16 FROM alpine:${ALPINE_VERSION} LABEL Maintainer="Ngoc Linh Pham " -LABEL Description="Lightweight container with Nginx 1.20 & PHP 8.1 based on Alpine Linux." +LABEL Description="Lightweight container with Nginx 1.22 & PHP 8.1 based on Alpine Linux." # Setup document root WORKDIR /var/www/html # Install packages and remove default server definition RUN apk add --no-cache \ - php81 \ - php81-fpm \ - php81-bcmath \ - php81-ctype \ - php81-fileinfo \ - php81-json \ - php81-mbstring \ - php81-openssl \ - php81-pdo_pgsql \ - php81-curl \ - php81-pdo \ - php81-tokenizer \ - php81-xml \ - php81-phar \ - php81-dom \ - php81-gd \ - php81-iconv \ - php81-xmlwriter \ - php81-xmlreader \ - php81-zip \ - php81-simplexml \ - php81-redis \ - php81-pdo_mysql \ - php81-pdo_pgsql \ - php81-pdo_sqlite \ - php81-soap \ - php81-pecl-apcu \ - php81-common \ - php81-sqlite3 \ - php81-opcache \ - php81-intl \ - curl \ - nginx \ - vim \ - nano \ - supervisor \ - git + php81 \ + php81-fpm \ + php81-bcmath \ + php81-ctype \ + php81-fileinfo \ + php81-json \ + php81-mbstring \ + php81-openssl \ + php81-pdo_pgsql \ + php81-pdo_mysql \ + php81-curl \ + php81-pdo \ + php81-tokenizer \ + php81-xml \ + php81-phar \ + php81-dom \ + php81-gd \ + php81-iconv \ + php81-xmlwriter \ + php81-xmlreader \ + php81-zip \ + php81-simplexml \ + php81-session \ + php81-opcache \ + php81-intl \ + php81-pecl-apcu \ + curl \ + nginx \ + runit # Install XDebug @@ -61,8 +53,8 @@ COPY config/81/nginx.conf /etc/nginx/nginx.conf COPY config/81/fpm-pool.conf /etc/php81/php-fpm.d/www.conf COPY config/81/php.ini /etc/php81/conf.d/custom.ini -# Configure supervisord -COPY config/81/supervisord.conf /etc/supervisor/conf.d/supervisord.conf +# Configure runit boot script +COPY config/81/boot.sh /sbin/boot.sh # Make sure files/folders needed by the processes are accessable when they run under the www user ARG nginxUID=1000 @@ -76,8 +68,12 @@ RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \ chown -R www:www /var/lib/nginx && \ chown -R www:www /var/log/nginx -# Switch to use a www user from here on -USER www +COPY config/81/nginx.run /etc/service/nginx/run +COPY config/81/php.run /etc/service/php/run + +RUN chmod +x /etc/service/nginx/run \ + && chmod +x /etc/service/php/run \ + && ls -al /var/www/html/ # Add application COPY --chown=www src/ /var/www/html/public @@ -88,8 +84,8 @@ COPY --chown=www config/81/etc/nginx/ssl /etc/nginx/ssl # Expose the port nginx is reachable on EXPOSE 80 443 -# Let supervisord start nginx & php-fpm -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] +# Let boot start nginx & php-fpm +CMD ["sh", "/sbin/boot.sh"] # Configure a healthcheck to validate that everything is up & running HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping From 67ae09dd2872a4db7e5a929da2d1816c844e59ed Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 7 Nov 2022 11:15:27 +0700 Subject: [PATCH 09/16] feat: add build for symfony 3 with php 7.4 Fix grep version, add node 10 to image --- README.md | 8 +- config/74/etc/nginx/ssl/localhost-key.pem | 28 ++++++ config/74/etc/nginx/ssl/localhost.pem | 27 ++++++ config/74/nginx.conf | 6 +- php7.4.Dockerfile | 8 +- php7.4.symfony-3.Dockerfile | 109 ++++++++++++++++++++++ 6 files changed, 183 insertions(+), 3 deletions(-) create mode 100644 config/74/etc/nginx/ssl/localhost-key.pem create mode 100644 config/74/etc/nginx/ssl/localhost.pem create mode 100644 php7.4.symfony-3.Dockerfile diff --git a/README.md b/README.md index 6955233..2cac785 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,18 @@ Simple docker image for Symfony development - Build image ```shell -./build php7.2 # Build image with php 7.4 +./build php7.2 # Build image with php 7.2 ./build php7.4 # Build image with php 7.4 ./build php8.0 # Build image with php 8.0 ./build php8.1 # Build image with php 8.1 ``` +- Build for Symfony 3 with PHP 7.4 + +```shell +docker build --no-cache -f php7.4.symfony-3.Dockerfile . -t pnlinh/symfony-3:php7.4 +``` + - Mount your code to be served with container ```shell diff --git a/config/74/etc/nginx/ssl/localhost-key.pem b/config/74/etc/nginx/ssl/localhost-key.pem new file mode 100644 index 0000000..a67554e --- /dev/null +++ b/config/74/etc/nginx/ssl/localhost-key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCkvEHnaZz5cIkN +BrCCB7Ae/Q4dw6jepyAjnMk0Hzo785ltLu9BUW2IoHahdJTkFX3eyfOIQscNLMO5 +tRs7SpoiDy0SCabl1pHhhhv5IZ0309Qi3lHdb3qsmdNoPAv9tqrxkeIhcjQYiHCC +rwvC9vrG7PPO1Ig6FLY/WaFd6SxwSbq1oHUSg1tbmHi5kcVPZCv5ox9PZsZNEvxD +MXMa3OTwyL86+Nu5q5ZGJR6GQv+RG390XUwoyVO9HagCi/EuO3lyRiDThvmYirj6 +fWHktsugzVUmrnXLT8wue1gY8cGBqV5DzYE6O3Rhfu3gTE5z8SutcLyKIh45qMZh +UnU4IStlAgMBAAECggEAHmRpGEOg5VhAwLl6ORMoCB+RyiX98s4MnOVhLY+RU9w2 +czFUjM10Et/f4xu6GHZqmX7SwlHnnWOj3JAwLPkvhJceLpS/SOoUUfJHGOh9s/4N +xj0UB3F4xX0/xpxFbhKUaSsL+DW0rM4HS+T1m4uraqXuuTr2wxhtIzTrE4NgYnq7 +6VJ19X81yA/P8bJaXIXsn+6WBj1SOyMB8gQs9kgcc3V6zy1ODKW5WRBrKTbHKMXK +1PKw0daZxOoDSXD3F5RUeEcKHe5wSkrv7cY0v42RYQ0Zpi1aEsEB6cRnwXCy/Qmy +KQpGeEdJMLsGM8b5pAACRHXB04O/C0zctJa127VoYQKBgQDYd/53XwqcU9ZB4Uql +fDYEPqy0ATay6KCuskQ12gH3lJ+zu93hU/5Sy1hTLQ9z1KF40HaDNMVVwWQ0Aln0 +eU4gTNRWvsToKx4rupJE+kAGvildchZZsjK2zXF4buLF2PkMVNaGTUdDPpSM/pxF +SR0hF+pN6/zXbwgCNbfePk/7bQKBgQDC0bUPzf9gw2vp9KoK0vvTCtJiT4kY6KTs +5Ab8Xsq8VT0BUdXoYVHsoipEcXzhY74a0snDE76jcAf1H7dX2BCkZxG9x8MZ0UqL +KOEr/vlCIV2CzgBhX4hUpegn0woVQywHQz6N9XMHMVnP6nMMo+FlTKtJr8qlLcLK +cvfuWNW82QKBgQCZblPbYG4w5+uRvpIeQbA3ygS3gbS3ktNxf8GBOgjy51FbH+ng +8JvvK1preiDdxPS+oWOfFCRa6DyR8Ki589FAa7SF16nRtd4ouJE8evQu01KWfWsC +IKB5mZy39ECgY24DI476moPMUesRFNbG9U/ESSM2H/KS8IwIpPKygBBI8QKBgHi7 +SP/gY1DuCmRUUUSf95uT60ktjQK4uexsa7/eZrlMAaBdvLhkB0ckQBlmU0PCcj9h +PdP82nmipevMmeyAY9/eV+pKb6gCQbX3wYNoYcQPtUmorCer8mqy3io/6NHAbPqb +O5rx7zUX6lalLmM49Ce42bWykVzH/R1FHkzBFMQRAoGAAMjYS4VFYW9s3Ay+7uw4 +pdE6n+ZqiGd3Zy2Coe7Zb1X+EyFd3zPCn9zt2Op/+EGFujAcPuTgmdDrHTmN7jjj +yfrZYgQcYTiwuMJHEmSOvBdSEEZFTpY+ZOAfIWd5nj9yo8SgTw7rARTs7u+hfJVg +6aTrDsyQBPBdBUFgbQK5Hmg= +-----END PRIVATE KEY----- diff --git a/config/74/etc/nginx/ssl/localhost.pem b/config/74/etc/nginx/ssl/localhost.pem new file mode 100644 index 0000000..8307c12 --- /dev/null +++ b/config/74/etc/nginx/ssl/localhost.pem @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEljCCAv6gAwIBAgIQEF2S3d2u219SokRJudgIeDANBgkqhkiG9w0BAQsFADCB +qzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMUAwPgYDVQQLDDdwbmxp +bmhAcG5saW5ocy1NQlAucm91dGVycy5zYXJpdGFzYS5pbyAoTmdvYyBMaW5oIFBo +YW0pMUcwRQYDVQQDDD5ta2NlcnQgcG5saW5oQHBubGluaHMtTUJQLnJvdXRlcnMu +c2FyaXRhc2EuaW8gKE5nb2MgTGluaCBQaGFtKTAeFw0yMjExMDQxMTQzMzFaFw0y +NTAyMDQxMTQzMzFaMGUxJzAlBgNVBAoTHm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0 +aWZpY2F0ZTE6MDgGA1UECwwxcG5saW5oQHBubGluaHMtTWFjQm9vay1Qcm8ubG9j +YWwgKE5nb2MgTGluaCBQaGFtKTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAKS8QedpnPlwiQ0GsIIHsB79Dh3DqN6nICOcyTQfOjvzmW0u70FRbYigdqF0 +lOQVfd7J84hCxw0sw7m1GztKmiIPLRIJpuXWkeGGG/khnTfT1CLeUd1veqyZ02g8 +C/22qvGR4iFyNBiIcIKvC8L2+sbs887UiDoUtj9ZoV3pLHBJurWgdRKDW1uYeLmR +xU9kK/mjH09mxk0S/EMxcxrc5PDIvzr427mrlkYlHoZC/5Ebf3RdTCjJU70dqAKL +8S47eXJGINOG+ZiKuPp9YeS2y6DNVSaudctPzC57WBjxwYGpXkPNgTo7dGF+7eBM +TnPxK61wvIoiHjmoxmFSdTghK2UCAwEAAaN7MHkwDgYDVR0PAQH/BAQDAgWgMBMG +A1UdJQQMMAoGCCsGAQUFBwMBMB8GA1UdIwQYMBaAFH3P3RtWPWRjggM1d6CrSAy8 +Yxe3MDEGA1UdEQQqMCiCCWxvY2FsaG9zdIILKi5sb2NhbGhvc3SCCCouZG9ja2Vy +hwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBgQBYmQwq8s+XhFmUvNajkl9K6sNNSLM9 +/jFJqImc7jxzZUzf7ImHSVGHhXAsSkb6HaSTkh8JkmOMVDS7eeB2x8QwFb9Gkefy +lTOthwbtOkhN3wZoqAnyQIJQvarkuWvI+CDm6ACMxnbOHFhy8y9z6i+HALcbVT0k +zxlR+dc5/NHlYDyk8mf+hAUFuqZ8Bd6+jBaGnTNMRgPVX/El6LYISFoklcfsU+We +4acYFGibY4YObGcVQlUlc23SaUp48Y2kSwu6dbbtqtNHcuvNbeVUl+2kCSB+TEy/ +5HHk7BXxXx75GhO+BgSWC+80v2RC2lsuPp2gTKkqwkfdZf2b0JJJz8Eof+KOyMYU +mxuQOPf2uCAYW7nfdA4ruuSfGXW9hkHCJeXv3SvUSVc4BJeK2nJrJPG/ja2T6M4O +WzWhw+mW6qA1Wcq0pdTRZKyM3QiyYpbdFSQpJYPBtc/qu0DRnKPqmRlVILdPX6yR +tulDEL9NH0hSho1VT80eOGtfRCb/l+87uYE= +-----END CERTIFICATE----- diff --git a/config/74/nginx.conf b/config/74/nginx.conf index a37c773..d0582db 100644 --- a/config/74/nginx.conf +++ b/config/74/nginx.conf @@ -33,13 +33,17 @@ http { server { listen [::]:80 default_server; listen 80 default_server; + listen 443 ssl http2; + listen [::]:443 ssl http2; + ssl_certificate /etc/nginx/ssl/localhost.pem; + ssl_certificate_key /etc/nginx/ssl/localhost-key.pem; server_name _; sendfile off; tcp_nodelay on; absolute_redirect off; - root /var/www/html/public; + root /var/www/html/web; index index.php index.html; location / { diff --git a/php7.4.Dockerfile b/php7.4.Dockerfile index 36484d8..fcc1434 100644 --- a/php7.4.Dockerfile +++ b/php7.4.Dockerfile @@ -8,6 +8,7 @@ WORKDIR /var/www/html # Install packages and remove default server definition RUN apk add --no-cache \ + grep \ php7 \ php7-fpm \ php7-bcmath \ @@ -34,6 +35,8 @@ RUN apk add --no-cache \ php7-opcache \ php7-intl \ php7-pecl-apcu \ + php7-ftp \ + php7-dba \ curl \ nginx \ runit @@ -78,8 +81,11 @@ RUN chmod +x /etc/service/nginx/run \ # Add application COPY --chown=www src/ /var/www/html/public +# SSL config +COPY --chown=www config/74/etc/nginx/ssl /etc/nginx/ssl + # Expose the port nginx is reachable on -EXPOSE 80 +EXPOSE 80 443 # Let boot start nginx & php-fpm CMD ["sh", "/sbin/boot.sh"] diff --git a/php7.4.symfony-3.Dockerfile b/php7.4.symfony-3.Dockerfile new file mode 100644 index 0000000..aa22ed8 --- /dev/null +++ b/php7.4.symfony-3.Dockerfile @@ -0,0 +1,109 @@ +ARG ALPINE_VERSION=3.15 +ARG NODE_VERSION=10 +FROM node:${NODE_VERSION}-alpine AS node +FROM alpine:${ALPINE_VERSION} +LABEL Maintainer="Ngoc Linh Pham " +LABEL Description="Lightweight container with Nginx 1.20 & PHP 7.4 based on Alpine Linux." + +# Setup document root +WORKDIR /var/www/html + +# Install packages and remove default server definition +RUN apk add --no-cache \ + grep \ + php7 \ + php7-fpm \ + php7-bcmath \ + php7-ctype \ + php7-fileinfo \ + php7-json \ + php7-mbstring \ + php7-openssl \ + php7-pdo_pgsql \ + php7-pdo_mysql \ + php7-curl \ + php7-pdo \ + php7-tokenizer \ + php7-xml \ + php7-phar \ + php7-dom \ + php7-gd \ + php7-iconv \ + php7-xmlwriter \ + php7-xmlreader \ + php7-zip \ + php7-simplexml \ + php7-session \ + php7-opcache \ + php7-intl \ + php7-pecl-apcu \ + php7-ftp \ + php7-dba \ + php7-redis \ + curl \ + nginx \ + runit + +# Add node repository with 10 version +COPY --from=node /usr/lib /usr/lib +COPY --from=node /usr/local/share /usr/local/share +COPY --from=node /usr/local/lib /usr/local/lib +COPY --from=node /usr/local/include /usr/local/include +COPY --from=node /usr/local/bin /usr/local/bin + +# Install node dependecis +RUN npm install -g \ + less@1.7.5 uglifycss coffee-script stylus nib typescript handlebars uglify-js@2 \ + autoprefixer autoprefixer-5 autoprefixer-cli roole clean-css + +# Install XDebug + +# Create symlink so programs depending on `php` still function +RUN cp /usr/bin/php7 /usr/bin/php + +# Install Composer +COPY --from=composer/composer:2-bin /composer /usr/bin/composer + +# Configure nginx +COPY config/74/nginx.conf /etc/nginx/nginx.conf + +# Configure PHP-FPM +COPY config/74/fpm-pool.conf /etc/php7/php-fpm.d/www.conf +COPY config/74/php.ini /etc/php7/conf.d/custom.ini + +# Configure runit boot script +COPY config/74/boot.sh /sbin/boot.sh + +# Make sure files/folders needed by the processes are accessable when they run under the www user +ARG nginxUID=1000 +ARG nginxGID=1000 + +RUN adduser -D -u ${nginxUID} -g ${nginxGID} -s /bin/sh www && \ + mkdir -p /var/www/html && \ + mkdir -p /var/cache/nginx && \ + chown -R www:www /var/www/html && \ + chown -R www:www /run && \ + chown -R www:www /var/lib/nginx && \ + chown -R www:www /var/log/nginx + +COPY config/74/nginx.run /etc/service/nginx/run +COPY config/74/php.run /etc/service/php/run + +RUN chmod +x /etc/service/nginx/run \ + && chmod +x /etc/service/php/run \ + && ls -al /var/www/html/ + +# Add application +COPY --chown=www src/ /var/www/html/public + +# SSL config +COPY --chown=www config/74/etc/nginx/ssl /etc/nginx/ssl + +# Expose the port nginx is reachable on +EXPOSE 80 443 + +# Let boot start nginx & php-fpm +CMD ["sh", "/sbin/boot.sh"] + +# Configure a healthcheck to validate that everything is up & running +HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:80/fpm-ping From d0736a491248bb13236ec6f0eb3a2308323bdd6b Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 7 Nov 2022 13:52:30 +0700 Subject: [PATCH 10/16] chore: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cac785..094536d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Simple docker image for Symfony development - Build for Symfony 3 with PHP 7.4 ```shell -docker build --no-cache -f php7.4.symfony-3.Dockerfile . -t pnlinh/symfony-3:php7.4 +docker build --no-cache -f php7.4.symfony-3.Dockerfile . -t pnlinh/symfony:3-php7.4 ``` - Mount your code to be served with container From ae7c0d1c32a66e0033ee14c82d03455ea9136424 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 28 Nov 2022 15:33:09 +0700 Subject: [PATCH 11/16] chore: update readme (cherry picked from commit 181201cfd57a51c9df95e29b6782331f12ed4fe1) --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 094536d..733a5b1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,23 @@ Simple docker image for Symfony development - Magento: https://github.com/pnlinh/docker-php/tree/feature/magento - PHP/Laravel: https://github.com/pnlinh/docker-php +### Why should use this image + +- Built on the lightweight and + secure [Alpine Linux](https://www.alpinelinux.org/) distribution +- Multi-platform, supporting AMD4, ARMv6, ARMv7, ARM64 +- Use [runit](http://smarden.org/runit/) instead + of [supervisor](http://supervisord.org/) +- Very small Docker image size + +### PHP version support + +- [x] PHP 7.2 +- [x] PHP 7.4 +- [x] PHP 8.0 +- [x] PHP 8.1 +- [ ] PHP 8.2 (todo) + ### How to use - Build image From 616a94116803125875803f61e4714e3a53fac482 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 28 Nov 2022 15:36:44 +0700 Subject: [PATCH 12/16] chore: add refs link (cherry picked from commit 96f1c1b888c1a768fff713cc4b85835bbf6aa1af) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 733a5b1..7d069a4 100644 --- a/README.md +++ b/README.md @@ -74,3 +74,4 @@ networks: ### References - https://github.com/TrafeX/docker-php-nginx +- https://bolshov.online/docker/2020/11/18/runit-vs-supervisor From bed9cad8ace8cf41d4057b3f62c5e573580ec2ab Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 28 Nov 2022 16:00:38 +0700 Subject: [PATCH 13/16] chore: update readme --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7d069a4..13279ba 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@ Simple docker image for Symfony development -- Magento: https://github.com/pnlinh/docker-php/tree/feature/magento -- PHP/Laravel: https://github.com/pnlinh/docker-php - ### Why should use this image - Built on the lightweight and @@ -71,6 +68,11 @@ networks: ![image](https://user-images.githubusercontent.com/26193890/198827932-7901d969-cf9c-4f2a-8154-e2b1fb4840f8.png) +### Useful images: + +- Magento: https://github.com/pnlinh/docker-php/tree/feature/magento +- PHP/Laravel: https://github.com/pnlinh/docker-php + ### References - https://github.com/TrafeX/docker-php-nginx From 8494c795e0718b0f91921759209c2a4dfa63f31e Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 28 Nov 2022 16:00:57 +0700 Subject: [PATCH 14/16] fix: typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13279ba..43a3182 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ networks: ![image](https://user-images.githubusercontent.com/26193890/198827932-7901d969-cf9c-4f2a-8154-e2b1fb4840f8.png) -### Useful images: +### Useful images - Magento: https://github.com/pnlinh/docker-php/tree/feature/magento - PHP/Laravel: https://github.com/pnlinh/docker-php From b82252ccd4fb4cfe4331405d039b260e7a7da2fa Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 28 Nov 2022 16:03:24 +0700 Subject: [PATCH 15/16] chore: update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43a3182..039269c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Simple docker image for Symfony development - [x] PHP 7.2 - [x] PHP 7.4 - [x] PHP 8.0 -- [x] PHP 8.1 +- [x] PHP 8.1 (recommend usage) - [ ] PHP 8.2 (todo) ### How to use From fca90a013600e6e7486bedb88fb68c2520976ac0 Mon Sep 17 00:00:00 2001 From: Ngoc Linh Pham Date: Mon, 5 Dec 2022 16:15:27 +0700 Subject: [PATCH 16/16] chore: remove check list files (cherry picked from commit 17de2bd2a316af9253612d22aff4bbc6c854a9af) --- php7.2.Dockerfile | 3 +-- php7.4.Dockerfile | 3 +-- php8.0.Dockerfile | 3 +-- php8.1.Dockerfile | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/php7.2.Dockerfile b/php7.2.Dockerfile index bfab383..c8d2fd0 100644 --- a/php7.2.Dockerfile +++ b/php7.2.Dockerfile @@ -75,8 +75,7 @@ COPY config/72/nginx.run /etc/service/nginx/run COPY config/72/php.run /etc/service/php/run RUN chmod +x /etc/service/nginx/run \ - && chmod +x /etc/service/php/run \ - && ls -al /var/www/html/ + && chmod +x /etc/service/php/run # Add application COPY --chown=www src/ /var/www/html/public diff --git a/php7.4.Dockerfile b/php7.4.Dockerfile index fcc1434..3f48c98 100644 --- a/php7.4.Dockerfile +++ b/php7.4.Dockerfile @@ -75,8 +75,7 @@ COPY config/74/nginx.run /etc/service/nginx/run COPY config/74/php.run /etc/service/php/run RUN chmod +x /etc/service/nginx/run \ - && chmod +x /etc/service/php/run \ - && ls -al /var/www/html/ + && chmod +x /etc/service/php/run # Add application COPY --chown=www src/ /var/www/html/public diff --git a/php8.0.Dockerfile b/php8.0.Dockerfile index 5a89af2..95350eb 100644 --- a/php8.0.Dockerfile +++ b/php8.0.Dockerfile @@ -72,8 +72,7 @@ COPY config/80/nginx.run /etc/service/nginx/run COPY config/80/php.run /etc/service/php/run RUN chmod +x /etc/service/nginx/run \ - && chmod +x /etc/service/php/run \ - && ls -al /var/www/html/ + && chmod +x /etc/service/php/run # Add application COPY --chown=www src/ /var/www/html/public diff --git a/php8.1.Dockerfile b/php8.1.Dockerfile index 7340fe8..a1c4cf8 100644 --- a/php8.1.Dockerfile +++ b/php8.1.Dockerfile @@ -72,8 +72,7 @@ COPY config/81/nginx.run /etc/service/nginx/run COPY config/81/php.run /etc/service/php/run RUN chmod +x /etc/service/nginx/run \ - && chmod +x /etc/service/php/run \ - && ls -al /var/www/html/ + && chmod +x /etc/service/php/run # Add application COPY --chown=www src/ /var/www/html/public