forked from kassambara/wordpress-docker-compose
-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose-onlinehost.yml
118 lines (108 loc) · 3.57 KB
/
docker-compose-onlinehost.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
version: '3.6'
services:
wordpress:
image: wordpress:latest
container_name: ${COMPOSE_PROJECT_NAME:-wordpress}
volumes:
- ./config/php.conf.ini:/usr/local/etc/php/conf.d/php.ini
- ${WORDPRESS_DATA_DIR:-./wordpress}:/var/www/html
environment:
- WORDPRESS_DB_NAME=${COMPOSE_PROJECT_NAME:-wordpress}
- WORDPRESS_TABLE_PREFIX=${WORDPRESS_TABLE_PREFIX:-wp_}
- WORDPRESS_DB_HOST=${WORDPRESS_DB_HOST:-mysql}
- WORDPRESS_DB_USER=${DATABASE_USER:-root}
- WORDPRESS_DB_PASSWORD=${DATABASE_PASSWORD:-password}
# For nginx-proxy
- VIRTUAL_HOST=${WORDPRESS_WEBSITE_URL_WITHOUT_HTTP}
- LETSENCRYPT_HOST=${WORDPRESS_WEBSITE_URL_WITHOUT_HTTP}
- LETSENCRYPT_EMAIL=${WORDPRESS_ADMIN_EMAIL}
- VIRTUAL_PORT=80
expose:
- 80
depends_on:
- mysql
- phpmyadmin
restart: always
networks:
- ${COMPOSE_PROJECT_NAME}_default
- nginx-proxy
# Redirect non-www to www
redirectnonwww:
image: cusspvz/redirect
container_name: ${COMPOSE_PROJECT_NAME}_redirectnonwww
restart: always
environment:
- VIRTUAL_HOST=${WORDPRESS_WEBSITE_URL_WITHOUT_WWW}
- HTTPS_METHOD=noredirect
- LETSENCRYPT_HOST=${WORDPRESS_WEBSITE_URL_WITHOUT_WWW}
- LETSENCRYPT_EMAIL=${WORDPRESS_ADMIN_EMAIL}
- REDIRECT=${WORDPRESS_WEBSITE_URL}
# CHANGE THE REDIRECT URL
- REDIRECT=https://www.change-me-with-your-domain.com
- WORKER_CONNECTIONS=1024
networks:
- ${COMPOSE_PROJECT_NAME}_default
- nginx-proxy
mysql:
image: mariadb:${MARIADB_VERSION:-latest}
container_name: ${COMPOSE_PROJECT_NAME}_mysql
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${DATABASE_PASSWORD:-password}
- MYSQL_USER=${DATABASE_USER:-root}
- MYSQL_PASSWORD=${DATABASE_PASSWORD:-password}
- MYSQL_DATABASE=${COMPOSE_PROJECT_NAME:-wordpress}
restart: always
networks:
- ${COMPOSE_PROJECT_NAME}_default
phpmyadmin:
depends_on:
- mysql
image: phpmyadmin/phpmyadmin:${PHPMYADMIN_VERSION:-latest}
container_name: ${COMPOSE_PROJECT_NAME}_phpmyadmin
restart: always
ports:
- ${PHPMYADMIN_PORT}:80
environment:
- PMA_HOST=mysql
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-password}
# For nginx-proxy
- VIRTUAL_HOST=${PHPMYADMIN_WEBSITE_URL_WITHOUT_HTTP}
- LETSENCRYPT_HOST=${PHPMYADMIN_WEBSITE_URL_WITHOUT_HTTP}
- LETSENCRYPT_EMAIL=${WORDPRESS_ADMIN_EMAIL}
- VIRTUAL_PORT=80
networks:
- ${COMPOSE_PROJECT_NAME}_default
- nginx-proxy
# Command line interface to wordpress
wpcli:
build: ./wpcli/
image: wpcli
container_name: ${COMPOSE_PROJECT_NAME}_wpcli
volumes:
- ${WORDPRESS_DATA_DIR:-./wordpress}:/var/www/html
working_dir: /var/www/html
networks:
- ${COMPOSE_PROJECT_NAME}_default
# Check availability of essential services
healthcheck:
image: wpcli
build: ./wpcli/
container_name: ${COMPOSE_PROJECT_NAME}_healthcheck
command: sh -c "/wait"
environment:
- WAIT_HOSTS=mysql:3306, wordpress:80
- WAIT_BEFORE_HOSTS=${WAIT_BEFORE_HOSTS:-30}
- WAIT_AFTER_HOSTS=${WAIT_AFTER_HOSTS:-15}
- WAIT_HOSTS_TIMEOUT=${WAIT_HOSTS_TIMEOUT:-300}
- WAIT_SLEEP_INTERVAL=${WAIT_SLEEP_INTERVAL:-30}
- WAIT_HOST_CONNECT_TIMEOUT=${WAIT_HOST_CONNECT_TIMEOUT:-30}
networks:
- ${COMPOSE_PROJECT_NAME}_default
networks:
wordpress_default:
name: ${COMPOSE_PROJECT_NAME}_default
nginx-proxy:
external:
name: nginx-proxy