Be based on
php official image
- php-fpm 7.* - 8.0
- phpunit
- composer
- pecl
- openresty
WORKDIR /srv
As default, will be removed default php,nginx config file and be generated by ENV PARAMS
- /usr/local/openresty/nginx/conf/nginx.conf
- /usr/local/openresty/nginx/conf/vhosts/default.conf
- /usr/local/etc/php-fpm.conf
- /usr/local/etc/php/php.ini
PHP 7.0/7.1 dose not include sodium lib
PHP 8.0 used xmlrpc version:
1.0.0RC2- swoole 4.6 no longer support php 7.1
- phpunit supported versions
image | php | openresty | composer | phpunit | swoole | mongodb | mysql | redis |
---|---|---|---|---|---|---|---|---|
8.0-v0.2 | 8.0.3 | 1.19.3.1 | 2.0.11 | 9.5.4 | 4.6.6 | 1.9.1 | 8.0.3 | 5.3.4 |
8.0-v0.1 | 8.0.3 | 1.19.3.1 | 1.10.21 | 9.5.4 | 4.6.6 | 1.9.1 | 8.0.3 | 5.3.4 |
7.4-v0.2 | 7.4.16 | 1.19.3.1 | 2.0.11 | 9.5.4 | 4.6.6 | 1.9.1 | 7.4.16 | 5.3.4 |
7.4-v0.1 | 7.4.16 | 1.19.3.1 | 1.10.21 | 9.5.4 | 4.6.6 | 1.9.1 | 7.4.16 | 5.3.4 |
7.3-v0.3 | 7.3.27 | 1.19.3.1 | 1.10.21 | 9.5.4 | 4.6.6 | 1.9.1 | 5.0.12-dev | 5.3.4 |
7.2-v0.3 | 7.2.34 | 1.19.3.1 | 1.10.21 | 8.5.15 | 4.3.3 | 1.9.1 | 5.0.12-dev | 5.3.4 |
7.1-v0.3 | 7.1.33 | 1.19.3.1 | 1.10.21 | 7.5.20 | 4.4.12 | 1.9.1 | 5.0.12-dev | 5.3.4 |
7.0-v0.3 | 7.0.33 | 1.19.3.1 | 1.10.21 | 6.5.14 | 2.2.0 | 1.9.1 | 5.0.12-dev | 5.3.4 |
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
json
libxml
mbstring
memcached
mongodb
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
bash /script/init-token.sh
- It will call sys param GITHUB_TOKEN
- Default ENV in
Dockerfile
ENV
# WORKLOAD ARGS
# default is "" , can input nginx,php
PARAMS=""
# php application config
PHP_ENABLE_LARAVEL_CONFIG_CACHE="false"
# PHP_RW_DIRECTORY="/srv/test,a,b,c"
PHP_RW_DIRECTORY=""
- Run openresty(nginx)
docker run -ti --rm \
-e PARAMS=nginx \
-e NGINX_ROOT="/var/web/www/public" \
-e NGINX_CLIENT_MAX_BODY_SIZE="100m" \
hk01/docker-php:7.2-v0.1
- Run dynamic php-fpm
docker run -ti --rm \
-e PARAMS=php \
-e PHP_PM="dynamic" \
-e PHP_POST_MAX_SIZE="8M" \
-e PHP_MAX_EXECUTION_TIME="600" \
-e PHP_RW_DIRECTORY="/srv/a,/srv/b,/srv/c" \
hk01/docker-php:7.2-v0.1
- Run static php-fpm
docker run -ti --rm \
-e PARAMS=php \
-e PHP_PM="static" \
-e PHP_PM_MAX_CHILDREN="20" \
hk01/docker-php:7.2-v0.1
- Run openresty, php-fpm
docker run -ti --rm \
-e PARAMS=all \
hk01/docker-php:7.2-v0.6
- Use special nginx access log format
docker run -ti --rm \
-e PARAMS=nginx \
-e NGINX_ACCESS_LOG_FORMAT='[$time_local] " " \"$request\" " " $status " " $request_time " " $upstream_response_time " " $body_bytes_sent " " $http_referer " " \"$http_user_agent\" " " $remote_addr " " $http_x_forwarded_for' \
hk01/docker-php:7.2-v0.6
- [demo project]
php-docker-demo/
├── Dockerfile
├── README.MD
├── composer.json
└── public
└── index.php
- Dockerfile
FROM hk01/docker-php:7.2-v0.6 AS installer
COPY . .
RUN composer install
# build image
FROM hk01/docker-php:7.2-v0.6 AS build
COPY . .
RUN composer install --no-dev --no-progress -o
- build a image
docker built -t example:v1 .