Skip to content

Instantly share code, notes, and snippets.

@mitramejia
Last active October 26, 2016 21:53
Show Gist options
  • Save mitramejia/8f4c199a9249b28163db43c4ed354f6b to your computer and use it in GitHub Desktop.
Save mitramejia/8f4c199a9249b28163db43c4ed354f6b to your computer and use it in GitHub Desktop.
Docker Compose config file for production apps using Geniem's wp-project template
##
# Nodejs container which installs and builds all frontend assets
##
#frontend:
# image: devgeniem/node-assets-builder
# volumes_from:
# - data
# command: /bin/bash -c "cd /var/www/project/web/app/themes/THEMENAME && npm install && ./node_modules/webpack/bin/webpack.js"
##
# Web Server which runs nginx+php
##
web:
container_name: sf_web
build: ./ # Dockerfile
ports:
- 80
links:
- db
- redis
- elasticsearch
volumes:
- ./web:/var/www/project/web
- ./web/wp:/var/www/project/web/wp
# In production uploads will be in /data/uploads/
# In development uploads will be in ./.docker/uploads:/var/www/uploads
# This way let the container see them like in production
- /var/www/uploads:/var/www/uploads
environment:
# Small variable to tell if we are in production,testing or development
# Don't use this in your code unless this is only option
# We want to nearly identical codebase in production and development
WP_ENV: staging
WP_UID: 100
WP_GID: 101
# Set databes env variables
DB_NAME: wordpress
DB_PASSWORD: wordpress
DB_USER: wordpress
# Set php to use redis for object cache & sessions
PHP_SESSION_HANDLER: redis
PHP_SESSION_REDIS_DB: 0
WP_REDIS_DATABASE: 1
# These will be mapped automatically in development to jwilder/nginx-proxy
VIRTUAL_HOST: http://staging.suplifacil.com
# Set project WP_SITEURL & HOME
WP_SITEURL: http://staging.suplifacil.com
WP_HOME: http://staging.suplifacil.com
# This is used automatically by wp-cli
# WP_CORE: /var/www/project/web/wp
# This is for your project root
PROJECT_ROOT: /var/www/project
# This is used by nginx and php-fpm
WEB_ROOT: /var/www/project/web
# Nginx include files
NGINX_INCLUDE_DIR: /var/www/project/nginx
# Allow bigger file uploads
NGINX_MAX_BODY_SIZE: 64M
# Have sane fastcgi timeout by default
NGINX_FASTCGI_TIMEOUT: 30
# This folder is used to mount files into host machine
# You should use this path for your uploads since everything else should be ephemeral
UPLOADS_ROOT: /var/www/uploads
# This can be overidden by you, it's just default for us
# Mysql details
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
# Mysql database prefix
DB_PREFIX: sf_
# This will use local mail.test server
SMTP_HOST: 172.17.0.1
# Time Zone setting
TZ: 'America/Santo_Domingo'
restart: always
##
# Use basic mariadb container for database
##
db:
container_name: sf_db
image: mariadb
volumes:
# Make database percd sistent
- /var/lib/mysql
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
MYSQL_ROOT_PASSWORD: root
restart: always
##
# Use elasticpress plugin and elasticsearch for quicker WP_Queries in WordPress
##
elasticsearch:
container_name: sf_elasticsearch
image: elasticsearch
volumes:
# Make elasticsearch persistent
- /usr/share/elasticsearch/data
restart: always
##
# We use redis for wp object cache and php sessions
##
redis:
container_name: sf_redis
image: redis
restart: always
##
# Use phpmyadmin to access the database
##
phpmyadmin:
container_name: sf_phpmyadmin
image: phpmyadmin/phpmyadmin
links:
- db:mysql
ports:
- 8181:80
environment:
MYSQL_USERNAME: wordpress
MYSQL_ROOT_PASSWORD: wordpress
PMA_HOST: mysql
restart: always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment