Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (103 loc) · 2.63 KB
/
Copy pathdocker-compose.yml
File metadata and controls
109 lines (103 loc) · 2.63 KB
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
version: '3.8'
services:
# PHP-FPM с Yii2
php:
build:
context: .
dockerfile: docker/php/Dockerfile
container_name: apple_php
working_dir: /app
volumes:
- ./:/app
- ~/.composer-docker/cache:/root/.composer/cache:delegated
- ./docker/php/php.ini:/usr/local/etc/php/conf.d/custom.ini
environment:
- PHP_IDE_CONFIG=serverName=apple_back
- DB_HOST=mysql
- DB_NAME=apple_db
- DB_USER=apple_user
- DB_PASSWORD=apple_password
- REDIS_HOST=redis
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "php-fpm -t || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- apple_network
# Nginx веб-сервер
nginx:
image: nginx:1.25-alpine
container_name: apple_nginx
ports:
- "20080:80" # Frontend
- "21080:81" # Backend
volumes:
- ./:/app
- ./docker/nginx/backend.conf:/etc/nginx/conf.d/backend.conf
- ./docker/nginx/frontend.conf:/etc/nginx/conf.d/frontend.conf
- ./docker/nginx/logs:/var/log/nginx
depends_on:
php:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:80/health" , "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- apple_network
# MySQL база данных
mysql:
image: mysql:8.0
container_name: apple_mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: verysecret
MYSQL_DATABASE: apple_db
MYSQL_USER: apple_user
MYSQL_PASSWORD: apple_password
volumes:
- mysql_data:/var/lib/mysql
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
command: --default-authentication-plugin=mysql_native_password
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pverysecret"]
interval: 10s
timeout: 5s
retries: 5
networks:
- apple_network
# Redis для кеширования
redis:
image: redis:7-alpine
container_name: apple_redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
networks:
- apple_network
volumes:
mysql_data:
driver: local
redis_data:
driver: local
networks:
apple_network:
driver: bridge