Skip to content

Commit 9bf1e9a

Browse files
committed
Updated image to use PHP7.1. Upped max children to allow 100 concurrent users
1 parent 3c17dbb commit 9bf1e9a

File tree

5 files changed

+22
-19
lines changed

5 files changed

+22
-19
lines changed

Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
FROM alpine:3.5
22
LABEL Maintainer="Tim de Pater <[email protected]>" \
3-
Description="Lightweight WordPress container with Nginx 1.10 & PHP-FPM 7.0 based on Alpine Linux."
3+
Description="Lightweight WordPress container with Nginx 1.10 & PHP-FPM 7.1 based on Alpine Linux."
44

5-
# Install packages
6-
RUN apk --no-cache add php7 php7-fpm php7-mysqli php7-json php7-openssl php7-curl \
7-
php7-zlib php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-ctype \
8-
php7-mbstring php7-gd nginx supervisor curl bash \
5+
# Install packages from testing repo's
6+
RUN apk --no-cache add php7.1 php7.1-fpm php7.1-mysqli php7.1-json php7.1-openssl php7.1-curl \
7+
php7.1-zlib php7.1-xml php7.1-phar php7.1-intl php7.1-dom php7.1-xmlreader php7.1-ctype \
8+
php7.1-mbstring php7.1-gd nginx \
99
--repository http://dl-cdn.alpinelinux.org/alpine/edge/main/ \
10-
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
10+
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/
11+
12+
# Install packages from stable repo's
13+
RUN apk --no-cache add supervisor curl bash
1114

1215
# Configure nginx
1316
COPY config/nginx.conf /etc/nginx/nginx.conf
1417

1518
# Configure PHP-FPM
16-
COPY config/fpm-pool.conf /etc/php7/php-fpm.d/zzz_custom.conf
17-
COPY config/php.ini /etc/php7/conf.d/zzz_custom.ini
19+
COPY config/fpm-pool.conf /etc/php7.1/php-fpm.d/zzz_custom.conf
20+
COPY config/php.ini /etc/php7.1/conf.d/zzz_custom.ini
1821

1922
# Configure supervisord
2023
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# WordPress Docker Container
22

3-
Lightweight WordPress container with Nginx 1.10 & PHP-FPM 7.0 based on Alpine Linux.
3+
Lightweight WordPress container with Nginx 1.10 & PHP-FPM 7.1 based on Alpine Linux.
44

55
_WordPress version currently installed:_ **4.7.3**
66

77
* Used in production for my own sites, making it stable, tested and up-to-date
8-
* Optimized for 50 concurrent users
8+
* Optimized for 100 concurrent users
99
* Optimized to only use resources when there's traffic (by using PHP-FPM's ondemand PM)
1010
* Best to be used with Amazon Cloudfront as SSL terminator and CDN
1111
* Built on the lightweight Alpine Linux distribution
1212
* Small Docker image size (+/-45MB)
13-
* Uses PHP 7.0 for better performance, lower cpu usage & memory footprint
13+
* Uses PHP 7.1 for better performance, lower cpu usage & memory footprint
1414
* Can safely be updated without loosing data
1515
* Fully configurable because wp-config.php uses the environment variables you can pass as a argument to the container
1616

config/fpm-pool.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pm = ondemand
1414
; forget to tweak pm.* to fit your needs.
1515
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
1616
; Note: This value is mandatory.
17-
pm.max_children = 50
17+
pm.max_children = 100
1818

1919
; The number of seconds after which an idle process will be killed.
2020
; Note: Used only when pm is set to 'ondemand'
@@ -25,7 +25,7 @@ pm.process_idle_timeout = 10s;
2525
; This can be useful to work around memory leaks in 3rd party libraries. For
2626
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
2727
; Default Value: 0
28-
pm.max_requests = 500
28+
pm.max_requests = 1000
2929

3030
; Make sure the FPM workers can reach the environment variables for configuration
3131
clear_env = no

config/nginx.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ worker_processes 1;
22
pid /run/nginx.pid;
33

44
events {
5-
worker_connections 1024;
5+
worker_connections 1024;
66
}
77

88
http {
9-
include mime.types;
10-
default_type application/octet-stream;
9+
include mime.types;
10+
default_type application/octet-stream;
1111

1212
log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" '
1313
'$status $body_bytes_sent "$http_referer" '
@@ -73,7 +73,7 @@ http {
7373
# Based on https://codeable.io/wordpress-developers-intro-to-docker-part-two/
7474
location /wp-content {
7575
root /var/www;
76-
expires 5d;
76+
expires 7d;
7777
add_header Cache-Control "public";
7878
}
7979

@@ -94,7 +94,7 @@ http {
9494
fastcgi_busy_buffers_size 256k;
9595

9696
fastcgi_index index.php;
97-
fastcgi_pass localhost:9000;
97+
fastcgi_pass localhost:9000;
9898

9999
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
100100
include fastcgi_params;

config/supervisord.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ logfile=/var/log/supervisord.log
44
pidfile=/run/supervisord.pid
55

66
[program:php-fpm]
7-
command=php-fpm7 -F
7+
command=php-fpm7.1 -F
88
stdout_logfile=/dev/stdout
99
stdout_logfile_maxbytes=0
1010
redirect_stderr=true

0 commit comments

Comments
 (0)