Alpine Linux, PHP, Nginx

快如闪电、超薄、生产加固: Alpine、PHP、Nginx docker 容器。(Lightning fast, super slim and production hardened: Alpine, PHP, Nginx docker container.)

Github星跟踪图

Alpine Linux, PHP, Nginx

A super fast, super slim, production hardened PHP 7.3/7.4 and Nginx docker image built on Alpine Linux.

Perfect for horizontally distributed PHP and Laravel applications run within a container cluster.

Stack

  • Alpine Linux
  • PHP 7.3/7.4 & PHP-FPM
    • mysqli
    • pdo, pdo_mysql + pdo_sqlite
    • opcache
    • pcntl
    • bcmath
    • exif
    • mbstring
    • gd
    • xdebug-2.9 (Not loaded)
  • NGINX 1.16 (FastCGI web-server)
  • Composer 2 (PHP package manager)
    • hirak/prestissimo was previously globally installed, but is no longer required nor supported under Composer 2
  • Supervisor Daemon (Process manager)
  • Tooling
    • git
    • wget
    • bash

Usage

This image should not be directly built, it a starting point for your own Dockerfile.

Your Dockerfile should ADD an Nginx configuration file at the very least.

Lightweight example Dockerfile of running a brand new Laravel application

docker build -f example/Dockerfile .

XDebug

XDebug is included with the image, but not enabled for the PHP runtime.
Lazily loading the xdebug module through command-line can be done via

php -d zend_extension=xdebug ...

Logging Output

A docker container should have the command it runs output to stdout and stderr, so the container runner (e.g. docker-compose / Kubernetes) can see this output and forward it to a logging system.

PHP

PHP-FPM has workers that can emit to php://stdout and php://stderr. These are captured by PHP-FPM's master process and can be logged to a single error log file. However, there is no way to send these to two separate files.

Additionally, a further file symlink would be needed to forward this output to /dev/stdout. But, PHP-FPM does not run as a user with the privilege to create this symlink or write to the file. Only root can write to /dev/stdout.

Possible Solutions

  1. Have php workers write to a file in a known location, /var/www/storage/logs/stdout.log.
  2. A process running as root tails this file and forwards it to /dev/stdout
  3. Another process truncates this file occasionally to prevent it from filling up the file system

主要指标

概览
名称与所有者ethical-jobs/aphex
主编程语言Dockerfile
编程语言Dockerfile (语言数: 2)
平台Linux
许可证MIT License
所有者活动
创建于2016-10-03 23:35:05
推送于2022-01-07 03:20:32
最后一次提交
发布数18
最新版本名称v9.0.1 (发布于 )
第一版名称7.1.1 (发布于 2017-01-25 11:03:22)
用户参与
星数60
关注者数1
派生数13
提交数129
已启用问题?
问题数4
打开的问题数1
拉请求数6
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?