-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yaml
95 lines (91 loc) · 2.34 KB
/
docker-compose.yaml
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
version: "3.7"
services:
php:
container_name: php #useful just without docker-swarm
hostname: php
build:
context: docker/php
target: development #target environment (development, production)
volumes:
- ./:/app
#- php-fpm:/usr/local/sbin/
networks:
- overlay
deploy:
mode: replicated
replicas: 1
labels: [APP=PHP]
# service resource management
resources:
# Hard limit - Docker does not allow to allocate more
limits:
cpus: '0.25'
memory: 512M
# Soft limit - Docker makes best effort to return to it
reservations:
cpus: '0.25'
memory: 256M
# service restart policy
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# service update configuration
update_config:
parallelism: 1
delay: 10s
failure_action: continue
monitor: 60s
max_failure_ratio: 0.3
# placement constraint - in this case on 'worker' nodes only
placement:
constraints: [node.role == development]
nginx:
container_name: nginx
hostname: nginx
build:
context: docker/nginx
ports:
- "80:80"
volumes:
- ./:/app
#- php-fpm:/run/php/ volume mapping sock unix php-fpm, you can change for TCP connection on nginx -> .conf -> fastcgi_pass
networks:
- overlay
depends_on:
- php
deploy:
mode: replicated
replicas: 1
labels: [APP=PHP, ENV=DEV]
# service resource management
resources:
# Hard limit - Docker does not allow to allocate more
limits:
cpus: '0.25'
memory: 512M
# Soft limit - Docker makes best effort to return to it
reservations:
cpus: '0.25'
memory: 256M
# service restart policy
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# service update configuration
update_config:
parallelism: 1
delay: 10s
failure_action: continue
monitor: 60s
max_failure_ratio: 0.3
# placement constraint - in this case on 'worker' nodes only
placement:
constraints: [node.role == development]
#volumes:
# php-fpm:
networks:
overlay: