-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
102 lines (94 loc) · 2.95 KB
/
docker-compose.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
# A Docker Compose setup for running most Wordpress environments
#
# Setup:
# 1. Configure wp-config.php to either pull the environment variables in
# services.web.environment or use the same settings.
# 2. Optionally put a database dump in the project root which will get imported
# on first project boot. This will remain persistent, so if you need to wipe
# the database, `docker volume ls` will help you find it and
# `docker volume rm [volume name]` to remove it.
# 3. `docker-compose up`
version: '3'
services:
web:
image: nginx:latest
ports:
- '8080:80'
volumes:
- './:/var/www/html'
environment:
- DB_HOST='database'
- DB_NAME='database'
- DB_USER='root'
- DB_PASSWORD=''
- WP_SITEURL='http://localhost:8080'
- WP_HOME='http://localhost:8080'
command: >
sh -c "echo '
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
index index.php index.html;
root /var/www/html/site;
location / {
try_files $$uri $$uri/ /index.php?$$args;
}
location ~ \.php$$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$$;
try_files $$uri =404;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $$document_root$$fastcgi_script_name;
fastcgi_param PHP_VALUE \"memory_limit = 1024M\";
set $$path_info $$fastcgi_path_info;
fastcgi_param PATH_INFO $$fastcgi_path_info;
fastcgi_param DB_HOST $$DB_HOST;
fastcgi_param DB_NAME $$DB_NAME;
fastcgi_param DB_USER $$DB_USER;
fastcgi_param DB_PASSWORD $$DB_PASSWORD;
fastcgi_param WP_SITEURL $$WP_SITEURL;
fastcgi_param WP_HOME $$WP_HOME;
}
}' | envsubst '$$DB_HOST $$DB_NAME $$DB_USER $$DB_PASSWORD $$WP_SITEURL $$WP_HOME' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
depends_on:
- php
links:
- php
php:
image: php:7.2-fpm
expose:
- '9000'
volumes:
- './:/var/www/html'
command: >
sh -c 'apt-get update && apt-get install -y mariadb-client zlib1g-dev libzip-dev libxml2-dev libpng-dev libjpeg-dev libfreetype6-dev && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \
docker-php-ext-install -j$$(nproc) mysqli zip gd
php-fpm'
depends_on:
- database
links:
- database
composer:
image: 'composer'
volumes:
- './:/app'
entrypoint: ['composer']
database:
image: mysql:5
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD='yes'
- MYSQL_ROOT_HOST=%
- MYSQL_DATABASE=database
- MYSQL_USER=root
expose:
- '3306'
ports:
- '3306:3306'
volumes:
- "database:/var/lib/mysql"
- ".:/docker-entrypoint-initdb.d"
volumes:
database: