Advertisement
najjah

WP docker-compose example

Apr 14th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. version: '3.5'
  2.  
  3. services:
  4.   wordpress:
  5.     image: wordpress-with-theme
  6.     build: <git-repo-here>
  7.     restart: unless-stopped
  8.     depends_on:
  9.      - database
  10.     healthcheck:
  11.       test: ["CMD", "curl", "-f", "http://localhost"]
  12.       interval: 15s
  13.       timeout: 15s
  14.       retries: 3
  15.     environment:
  16.      - WORDPRESS_DB_NAME=testing
  17.       - WORDPRESS_DB_USER=testing
  18.       - WORDPRESS_DB_PASSWORD=testing
  19.       - WORDPRESS_DB_HOST=database
  20.     volumes:
  21.      - "./conf/back/custom.ini:/usr/local/etc/php/conf.d/custom.ini:z" # DO NOT REMOVE! Necessary PHP settings
  22.       - "backend-theme:/var/www/html/wp-content/themes/theme"           # DO NOT REMOVE! Needed for docker-based theme
  23.       - "backend-content:/var/www/html/wp-content"                      # DO NOT REMOVE! Data persistence for plugins, uploads and other folders
  24.       - "backend-root:/var/www/html" # DO NOT REMOVE! Needed for wp-cli
  25.  
  26.   database:
  27.     image: mariadb:10
  28.     restart: unless-stopped
  29.     healthcheck:
  30.       test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
  31.       interval: 15s
  32.       timeout: 5s
  33.       retries: 3
  34.     environment:
  35.      - MYSQL_RANDOM_ROOT_PASSWORD=yes
  36.       - MYSQL_DATABASE=testing
  37.       - MYSQL_USER=testing
  38.       - MYSQL_PASSWORD=testing
  39.     volumes:
  40.      - "./import:/docker-entrypoint-initdb.d:Z"
  41.       - "database:/var/lib/mysql"
  42.  
  43.   cli:
  44.     image: wordpress:cli
  45.     depends_on:
  46.      - wordpress
  47.     user: "33:33"
  48.     working_dir: "/var/www/html"
  49.     volumes:
  50.      - "./conf/back/custom.ini:/usr/local/etc/php/conf.d/custom.ini:z" # DO NOT REMOVE! Necessary PHP settings
  51.       - "backend-theme:/var/www/html/wp-content/themes/theme"           # DO NOT REMOVE! Needed for docker-based theme
  52.       - "backend-content:/var/www/html/wp-content"                      # DO NOT REMOVE! Data persistence for plugins, uploads and other folders
  53.       - "backend-root:/var/www/html" # DO NOT REMOVE! Needed for wp-cli
  54.  
  55. volumes:
  56.   database:
  57.   backend-content:
  58.   backend-root:
  59.  backend-theme:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement