Merge branch 'feature/alpine-linux'

This commit is contained in:
Tim de Pater 2016-03-16 13:46:15 +01:00
commit 60c73f6bf2
6 changed files with 97 additions and 65 deletions

View File

@ -4,7 +4,7 @@ services:
env:
global:
- COMMIT=${TRAVIS_COMMIT::8}
- REPO=trafex/php-nginx
- REPO=trafex/alpine-nginx-php7
script:
- docker --version

View File

@ -1,26 +1,17 @@
FROM php:7.0-fpm
FROM alpine:latest
# Install Nginx
ENV NGINX_VERSION 1.9.11-1~jessie
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y ca-certificates nginx=${NGINX_VERSION} gettext-base \
&& rm -rf /var/lib/apt/lists/*
# Install supervisor
RUN apt-get update && apt-get install -y supervisor
# Install packages
RUN apk --update add php7-fpm nginx supervisor --repository http://nl.alpinelinux.org/alpine/edge/testing/
# Configure nginx
RUN rm /etc/nginx/conf.d/default.conf
COPY config/nginx.conf /etc/nginx/conf.d/nginx.conf
# Configure supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/nginx.conf /etc/nginx/nginx.conf
# Configure PHP-FPM
COPY config/php.ini /usr/local/etc/php/conf.d/custom.ini
COPY config/fpm-pool.conf /etc/php7/php-fpm.d/zzz_custom.conf
COPY config/php.ini /etc/php7/conf.d/zzz_custom.ini
# Configure supervisord
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Add application
RUN mkdir -p /var/www/html
@ -28,4 +19,4 @@ WORKDIR /var/www/html
COPY src/ /var/www/html/
EXPOSE 80 443
CMD ["/usr/bin/supervisord"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@ -1,10 +1,10 @@
Docker PHP-FPM 7.0 & Nginx 1.9 setup
====================================
Example PHP-FPM 7.0 & Nginx 1.9 setup for Docker
Docker PHP-FPM 7.0 & Nginx 1.8 on Alpine Linux
==============================================
Example PHP-FPM 7.0 & Nginx 1.8 setup for Docker, build on [Alpine Linux](http://www.alpinelinux.org/).
The image is only +/- 60MB large.
[![Docker Pulls](https://img.shields.io/docker/pulls/trafex/php-nginx.svg)](https://hub.docker.com/r/trafex/php-nginx/)
[![Docker Pulls](https://img.shields.io/docker/pulls/trafex/alpine-nginx-php7.svg)](https://hub.docker.com/r/trafex/alpine-nginx-php7/)
Usage
-----

28
config/fpm-pool.conf Normal file
View File

@ -0,0 +1,28 @@
[www]
; Enable status page
pm.status_path = /fpm-status
; Ondemand process manager
pm = ondemand
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 50
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 500

View File

@ -1,3 +1,15 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
server {
listen [::]:80 default_server;
listen 80 default_server;
@ -47,3 +59,4 @@ server {
deny all;
}
}
}

View File

@ -2,7 +2,7 @@
nodaemon=true
[program:php-fpm]
command=php-fpm
command=php-fpm7 -F
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr