mirror of
https://github.com/mashirozx/docker-php-nginx.git
synced 2024-11-22 14:58:15 +08:00
Switched to Alpine Linux for a smaller footprint
This commit is contained in:
parent
ac0380bf08
commit
fb9719f647
29
Dockerfile
29
Dockerfile
@ -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"]
|
||||
|
28
config/fpm-pool.conf
Normal file
28
config/fpm-pool.conf
Normal 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
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user