Skip to content

Instantly share code, notes, and snippets.

@pentago
Created November 9, 2018 16:40
Show Gist options
  • Save pentago/409ca713b189abf1fb39cf345583ae37 to your computer and use it in GitHub Desktop.
Save pentago/409ca713b189abf1fb39cf345583ae37 to your computer and use it in GitHub Desktop.
version: '3.7'
services:
### Web Server
nginx:
container_name: 'nginx'
image: 'nginx:${NGINX_VERSION}' # https://hub.docker.com/_/nginx/
ports:
- 80:80
- 443:443
volumes:
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./config/nginx/conf.d:/etc/nginx/conf.d:ro
- ./config/nginx/h5bp:/etc/nginx/h5bp:ro
- ./config/nginx/mime.types:/etc/nginx/mime.types:ro
- ./data/nginx/cloudflare-ips.txt:/etc/nginx/cloudflare-ips.txt:ro
- ./wordpress:/var/www/html:ro
- ./logs/nginx:/var/log/nginx
networks:
- frontend
restart: always
depends_on:
- wordpress
### Database
mysql:
container_name: 'mysql'
image: 'mariadb:${MARIADB_VERSION}' # https://hub.docker.com/_/mariadb/
command: [
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci'
]
ports:
- 3306:3306
volumes:
- ./data/mysql:/var/lib/mysql
- ./config/mysql/custom.cnf:/etc/mysql/conf.d/custom.cnf:ro
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
networks:
- backend
restart: always
### Database Administration GUI
adminer:
container_name: 'adminer'
image: 'adminer:${ADMINER_VERSION}' # https://hub.docker.com/_/adminer/
ports:
- 8080:8080
environment:
- ADMINER_DEFAULT_SERVER=${WORDPRESS_DB_HOST}
- ADMINER_PLUGINS=${ADMINER_PLUGINS}
networks:
- frontend
- backend
restart: always
depends_on:
- mysql
### Web Application
wordpress:
container_name: 'wordpress'
image: 'wordpress:${WORDPRESS_VERSION}' # https://hub.docker.com/_/wordpress/
user: ${UID}:${GID}
environment:
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST}
- WORDPRESS_DB_USER=${WORDPRESS_DB_USER}
- WORDPRESS_DB_NAME=${WORDPRESS_DB_NAME}
- WORDPRESS_DB_PASSWORD=${WORDPRESS_DB_PASSWORD}
- WORDPRESS_DEBUG=${WORDPRESS_DEBUG}
- |
WORDPRESS_CONFIG_EXTRA=
define( 'FORCE_SSL_ADMIN', true );
define( 'WP_REDIS_CLIENT', 'predis' );
define( 'WP_REDIS_SCHEME', 'tcp' );
define( 'WP_REDIS_HOST', 'redis' );
define( 'WP_REDIS_PORT', '6379' );
define( 'WP_REDIS_PASSWORD', 'EfSrjUsiYsV3n8aa7xtSW0EZKZ90MRZUtUwhvk3QlM4Mo221K7d0VQBPJi1P1Cp41yAIuRZ8o273uElw5fyLyHA8HDoWU6vI4cz1' );
define( 'WP_REDIS_DATABASE', '0' );
define( 'WP_REDIS_MAXTTL', '21600' );
define( 'WP_CACHE_KEY_SALT', 'redis_ ');
define( 'WP_REDIS_SELECTIVE_FLUSH', 'redis_ ');
define( 'WP_AUTO_UPDATE_CORE', false );
define( 'WP_DEBUG_LOG', true );
volumes:
- ./config/php/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
- ./wordpress:/var/www/html
- ./logs/php:/var/logs/php
networks:
- frontend
- backend
restart: always
depends_on:
- mysql
#### Cache
redis:
container_name: 'redis'
user: ${UID}:${GID}
image: 'redis:${REDIS_VERSION}' # https://hub.docker.com/_/redis/
command: ['redis-server', '/usr/local/etc/redis/redis.conf']
ports:
- 6379:6379
volumes:
- ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
- ./data/redis:/data
networks:
- backend
restart: always
depends_on:
- wordpress
networks:
frontend: {}
backend: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment