Sign inSign up

pristtlt/lnp-base

By pristtlt

Updated over 5 years ago

docker-php include openresty

Image
1

10K+

pristtlt/lnp-base repository overview

PHP BASE IMAGE

Be based on php official image

Include program

- php-fpm 7.*
- phpunit
- composer
- pecl
- openresty

Default WORKDIR

WORKDIR /srv

PHP 7.0/7.1/7.2/7.3 modules

  • PHP 7.0/7.1 dose not include sodium lib
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
json
libxml
mbstring
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

ENV

Default ENV in Dockerfile

# BUILD ARGS
# usually will be used to do some unit test,
# and build final image

## pull private repo
# git user
GIT_USER=""

# git password or private token
GIT_TOKEN=""

# git server scheme , default is https
GIT_HOST_SCHEME=""

# git service host, default is github.com
GIT_HOST=""

# composer auth token, in general, 
# used to pull private repo
COMPOSER_AUTH=""

#################################

# WORKLOAD ARGS

# default is "" , can input nginx,php
PARAMS=""

# default php.ini conf
PHP_UPLOAD_MAX_FILESIZE="8M" 
PHP_POST_MAX_SIZE="8M" 
PHP_MAX_EXECUTION_TIME="600" 
PHP_MAX_INPUT_TIME="600" 
PHP_MEMORY_LIMIT="128M" 

# default php-fpm conf
PHP_REQUEST_TERMINATE_TIMEOUT="65" 
PHP_REQUEST_SLOWLOG_TIMEOUT="2" 
PHP_PROCESS_CONTROL_TIMEOUT="60s"
PHP_PM="dynamic"
PHP_PM_MAX_CHILDREN="100"
PHP_PM_START_SERVERS="10"
PHP_PM_MIN_SPARE_SERVERS="10"
PHP_PM_MAX_SPARE_SERVERS="50"
PHP_PM_MAX_REQUESTS="102400"

# default  nginx vhost
NGINX_ROOT="/var/web/www/public" 
NGINX_CLIENT_MAX_BODY_SIZE="8m" 

# php larvael enable cache 
PHP_ENABLE_LARAVEL_CONFIG_CACHE="false"

HOW TO USE

Run container as workload

  • Run openresty(nginx)
docker run -ti --rm \
  -e PARAMS=nginx \
  -e NGINX_ROOT="/var/web/www/public" \
  -e NGINX_CLIENT_MAX_BODY_SIZE="100m" \
  pristtlt/lnp-base:7.2-fpm-stretch
  • 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" \
  pristtlt/lnp-base:7.2-fpm-stretch
  • Run static php-fpm
docker run -ti --rm \
  -e PARAMS=php \
  -e PHP_PM="static" \
  -e PHP_PM_MAX_CHILDREN="20" \
  pristtlt/lnp-base:7.2-fpm-stretch

Build image example

php-docker-demo/
├── Dockerfile
├── README.MD
├── composer.json
└── public
    └── index.php
  • Docker file
FROM pristtlt/lnp-base:7.2.19-fpm-stretch AS installer

COPY . .

RUN composer install

# build image
FROM pristtlt/lnp-base:7.2.19-fpm-stretch  AS build

COPY . .

RUN composer install --no-dev --no-progress -o 
  • build a image
docker built -t example:v1 \
.

Thanks

Docker repo

pristtlt/lnp-base

Tag summary

Content type

Image

Digest

Size

209.2 MB

Last updated

over 5 years ago

docker pull pristtlt/lnp-base:8.0.3-fpm-buster-v0.2.134