-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
52 lines (49 loc) · 1002 Bytes
/
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
version: '3.8'
services:
app:
build:
context: .
container_name: python-server
environment:
DB_HOST: mysql_db
DB_NAME: myappdb
DB_USER: ada
DB_PASSWORD: test
ports:
- 127.0.0.1:80:80
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:80/jokes"]
interval: 10s
timeout: 5s
retries: 3
volumes:
- .:/app
networks:
- myapp_network
db:
image: mysql:latest
restart: always
container_name: mysql_db
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: myappdb
MYSQL_USER: ada
MYSQL_PASSWORD: test
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
networks:
- myapp_network
volumes:
db_data:
networks:
myapp_network: