-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.prod.yml
93 lines (88 loc) · 2.54 KB
/
docker-compose.prod.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
services:
php:
container_name: php
build:
context: .
target: sylius_php_prod
depends_on:
- mysql
environment:
APP_DEBUG: 0
APP_ENV: prod
APP_SECRET: EDITME
DATABASE_URL: mysql://sylius:${MYSQL_PASSWORD}@mysql/sylius_prod
MAILER_URL: smtp://localhost
MESSENGER_TRANSPORT_DSN: doctrine://default
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
volumes:
# use a bind-mounted host directory, as we want to keep the sessions
- ./var/sessions:/srv/sylius/var/sessions:rw
# use a bind-mounted host directory, as we want to keep the media
- ./public/media:/srv/sylius/public/media:rw
networks:
- sylius
cron:
container_name: cron
build:
context: .
target: sylius_cron
depends_on:
- mysql
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://sylius:${MYSQL_PASSWORD}@mysql/sylius_prod
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- sylius
worker:
container_name: worker
command: ["php", "bin/console", "messenger:consume", "main", "catalog_promotion_removal", "--limit=5", "--memory-limit=256M", "--time-limit=600"]
restart: always
build:
context: .
target: sylius_php_prod
depends_on:
- mysql
environment:
APP_ENV: prod
APP_DEBUG: 0
APP_SECRET: EDITME
DATABASE_URL: mysql://sylius:${MYSQL_PASSWORD}@mysql/sylius_prod
MESSENGER_TRANSPORT_DSN: doctrine://default
PHP_DATE_TIMEZONE: ${PHP_DATE_TIMEZONE:-UTC}
networks:
- sylius
mysql:
container_name: mysql
# in production, we may want to use a managed database service
image: mysql:5.7 # Sylius is fully working on mysql 8.0 version
environment:
MYSQL_RANDOM_ROOT_PASSWORD: true
MYSQL_DATABASE: sylius_prod
MYSQL_USER: sylius
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?MYSQL_PASSWORD is not set or empty}
volumes:
# use a bind-mounted host directory, because we never want to lose our data!
- ./docker/mysql/data:/var/lib/mysql:rw,delegated
networks:
- sylius
nginx:
container_name: nginx
# in production, we may want to use a static website hosting service
build:
context: .
target: sylius_nginx
depends_on:
- php
volumes:
# use a bind-mounted host directory, as we want to keep the media
- ./public/media:/srv/sylius/public/media:ro
networks:
- sylius
ports:
- 80:80
networks:
sylius:
driver: bridge