Skip to content

Instantly share code, notes, and snippets.

@AlexanderAllen
Created February 1, 2020 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexanderAllen/652fede10c886b4764da01d81d6c35fb to your computer and use it in GitHub Desktop.
Save AlexanderAllen/652fede10c886b4764da01d81d6c35fb to your computer and use it in GitHub Desktop.
Switching to unix socket with named volumes for PHP FPM and Nginx
# Staying on version 2.x for performance tuning cpu, memory resources.
# Ver. 3.x is meant for swarms and is not 100% backwards-compat.
# Secrets are available only on 3.x.
version: '3.7'
networks:
default:
external: true
name: localenv
services:
nginx:
image: alexanderallen/nginx:1.17-alpine
tty: true
ports:
- 80:8080
- 443:443
volumes:
- drawer:/sock
healthcheck:
test: curl --fail -s http://localhost:80 || exit 1
interval: 30s
timeout: 10s
retries: 2
mysql:
hostname: mysql
image: alexanderallen/mariadb-alpine:10.4.10-r0
ports:
- 3306:3306
volumes:
- mysql:/var/lib/mysql
pma:
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
environment:
PMA_USER: docker
PMA_PASSWORD:
PMA_HOST: mysql
memcached:
# Memcached 1.5.20 released Nov 11, 2019.
# https://hub.docker.com/_/memcached
image: memcached:1.5.20-alpine
command: -p 11211 -m 16 -vvv -M
php-fpm:
# By default use prod image.
image: "alexanderallen/php7-fpm.${ENVIRONMENT:-prod}:alpine-3.11"
# Allow nobody user logging to /dev/stdout.
tty: true
environment:
PHP_FPM_LISTEN: /sock/docker.sock
PHP_INI_MAX_EXECUTION_TIME: 0 # Set to 0 for unlimited.
PHP_INI_MEM_LIMIT: 256M # The default memory limit is 128M.
# PHP_FPM_LISTEN: 127.0.0.1:9010 # The default port is 9000, which conflicts with XDebug. Move to 9010.
PHP_FPM_LISTEN: 9010 # The default port is 9000, which conflicts with XDebug. Move to 9010.
PHP_FPM_WORKER_LOGOUTPUT: 1
# todo: healthcheck
volumes:
- drawer:/sock
volumes:
mysql:
drawer:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment