-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocker-compose.production.yml
119 lines (109 loc) · 3.1 KB
/
docker-compose.production.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
117
118
119
x-php: &php
build:
context: docker/php
dockerfile: php.dockerfile
args:
ENVIRONMENT: production
restart: unless-stopped
working_dir: /srv
volumes:
- .:/srv
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
x-logging: &logging
logging:
driver: json-file
options:
max-size: 100m
max-file: 10
services:
traefik:
<<: *logging
image: traefik:v3.0
restart: unless-stopped
command: >-
--entryPoints.web.address=:80
--entryPoints.web.http.redirections.entrypoint.to=web-secure
--entryPoints.web.http.redirections.entrypoint.scheme=https
--entryPoints.web-secure.address=:443
--ping=true
--api=false
--api.dashboard=false
--providers.docker=true
--providers.docker.exposedByDefault=false
--providers.file.directory=/srv/configs
--providers.file.watch=true
--certificatesResolvers.lets-encrypt.acme.email=email@example.com
--certificatesResolvers.lets-encrypt.acme.storage=/srv/.certificates/acme.json
--certificatesResolvers.lets-encrypt.acme.tlsChallenge=true
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik:/srv
labels:
- traefik.enable=false
- traefik.http.routers.traefik.rule=Host(`traefik.docker.localhost`)
- traefik.http.routers.traefik.service=api@internal
- traefik.http.routers.traefik.tls=true
- traefik.http.routers.traefik.tls.certResolver=lets-encrypt
- traefik.http.routers.traefik.middlewares=basic-auth@file,www-to-https@file
- traefik.http.services.traefik.loadBalancer.server.port=8080
healthcheck:
test: traefik healthcheck --ping
php:
<<: [ *php, *logging ]
labels:
- traefik.enable=true
- traefik.http.routers.php.entryPoints=web-secure
- traefik.http.routers.php.rule=Host(`app.docker.localhost`) || Host(`api.docker.localhost`)
- traefik.http.routers.php.tls=true
- traefik.http.routers.php.tls.certResolver=lets-encrypt
- traefik.http.routers.php.middlewares=www-to-https@file
queue:
<<: [ *php, *logging ]
command: php artisan horizon
healthcheck:
test: php artisan horizon:status
scheduler:
<<: [ *php, *logging ]
command: supercronic /srv/docker/php/config/schedule.cron
healthcheck:
disable: true
mysql:
<<: *logging
image: mysql:8.0-debian
restart: unless-stopped
volumes:
- mysql-data:/var/lib/mysql
environment:
MYSQL_DATABASE: $DB_DATABASE
MYSQL_USER: $DB_USERNAME
MYSQL_PASSWORD: $DB_PASSWORD
MYSQL_ROOT_PASSWORD: $DB_PASSWORD
healthcheck:
test: mysqladmin ping
redis:
<<: *logging
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis-data:/data
healthcheck:
test: redis-cli ping
actions:
<<: [ *php, *logging ]
restart: no
command:
- /bin/sh
- -c
- |
echo "Running migration..."
php artisan migrate --force --step --isolated
volumes:
redis-data:
mysql-data: