Giter Site home page Giter Site logo

docker-alpine-php-fpm's Introduction

Docker image for php-fpm

Build Status

Tags:

Image for php-fpm. It is based on Alpine linux and thats why it is very small (~65MB). Included extensions are required for Symfony framework 3+, that's why it should also work with other applications.

  • PHP 7.0.15

Running

docker run --rm -p 9000:9000 -v /path/of/application:/application yavin/alpine-php-fpm:7.0

Fallowing nginx configuration allow to connect to this FPM setup:

server {
    # here some other configuration...

    location ~ \.php(/|$) {
        include       fastcgi_params;
        fastcgi_param DOCUMENT_ROOT   /application/web;
        fastcgi_param SCRIPT_FILENAME /application/web$fastcgi_script_name;
        fastcgi_pass  fpm-host-name:9000;
    }
}

Please note the path that is passed to FPM and compare it with the docker run command. Above example assume that the /application/web is the "public" folder of your app. If paths in FPM container are the same as in Nginx you can replace it with $realpath_root nginx variable.

Custom php.ini settings

Create Dockerfile file with fallowing content and php.ini file with desired settings (look at php.ini file in this repository)

FROM yavin/alpine-php-fpm:7.0
COPY php.ini /etc/php7/conf.d/50-setting.ini

And then

docker build -t my-php-fpm .
docker run --rm -p 9000:9000 -v /path/of/application:/application my-php-fpm:latest

Change FPM parameters

Copy php-fpm.conf and modify. You will probably want to change process manager settings:

; ...
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 5
; ...

and build your image:

FROM yavin/alpine-php-fpm:7.0
COPY php-fpm.conf /etc/php7/php-fpm.conf

Add extension that you need

FROM yavin/alpine-php-fpm:7.0
RUN apk --update add php7-ftp && rm -rf /var/cache/apk/*

PHP extensions included:

$ php -m
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
gd
hash
iconv
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
soap
SPL
standard
tokenizer
xml
xmlwriter
Zend OPcache
zip

[Zend Modules]
Zend OPcache
Other php7 packages available in repository
$ apk --update search php7
php7-intl-7.0.15-r0
php7-openssl-7.0.15-r0
php7-dba-7.0.15-r0
php7-sqlite3-7.0.15-r0
php7-pear-7.0.15-r0
php7-phpdbg-7.0.15-r0
php7-litespeed-7.0.15-r0
php7-gmp-7.0.15-r0
php7-pdo_mysql-7.0.15-r0
php7-pcntl-7.0.15-r0
php7-common-7.0.15-r0
php7-xsl-7.0.15-r0
php7-fpm-7.0.15-r0
php7-mysqlnd-7.0.15-r0
php7-enchant-7.0.15-r0
php7-pspell-7.0.15-r0
php7-snmp-7.0.15-r0
php7-doc-7.0.15-r0
php7-mbstring-7.0.15-r0
php7-dev-7.0.15-r0
php7-xmlrpc-7.0.15-r0
php7-embed-7.0.15-r0
php7-xmlreader-7.0.15-r0
php7-pdo_sqlite-7.0.15-r0
php7-exif-7.0.15-r0
php7-opcache-7.0.15-r0
php7-ldap-7.0.15-r0
php7-posix-7.0.15-r0
php7-session-7.0.15-r0
php7-gd-7.0.15-r0
php7-gettext-7.0.15-r0
php7-json-7.0.15-r0
php7-xml-7.0.15-r0
php7-7.0.15-r0
php7-iconv-7.0.15-r0
php7-sysvshm-7.0.15-r0
php7-curl-7.0.15-r0
php7-shmop-7.0.15-r0
php7-odbc-7.0.15-r0
php7-phar-7.0.15-r0
php7-pdo_pgsql-7.0.15-r0
php7-imap-7.0.15-r0
php7-pdo_dblib-7.0.15-r0
php7-pgsql-7.0.15-r0
php7-pdo_odbc-7.0.15-r0
php7-xdebug-2.5.0-r1
php7-zip-7.0.15-r0
php7-apache2-7.0.15-r0
php7-cgi-7.0.15-r0
php7-ctype-7.0.15-r0
php7-mcrypt-7.0.15-r0
php7-wddx-7.0.15-r0
php7-bcmath-7.0.15-r0
php7-calendar-7.0.15-r0
php7-tidy-7.0.15-r0
php7-dom-7.0.15-r0
php7-sockets-7.0.15-r0
php7-soap-7.0.15-r0
php7-apcu-5.1.8-r0
php7-sysvmsg-7.0.15-r0
php7-zlib-7.0.15-r0
php7-ftp-7.0.15-r0
php7-sysvsem-7.0.15-r0
php7-pdo-7.0.15-r0
php7-bz2-7.0.15-r0
php7-mysqli-7.0.15-r0
Licence

MIT

docker-alpine-php-fpm's People

Contributors

icewind1991 avatar lewiscowles1986 avatar yavin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.