-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
58 lines (53 loc) Β· 1.69 KB
/
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
53
54
55
56
57
58
services:
node-service:
build:
context: .
dockerfile: node/Dockerfile
container_name: node-container # Simplified container name
restart: always
depends_on:
mysql-service:
condition: service_healthy # Web waits for DB to be healthy before starting
ports:
- "3000:3000" # Map internal port 3000 to host port 3001
networks:
- app_network # Updated network name for consistency
flask-service:
build:
context: .
dockerfile: python/Dockerfile
container_name: flask-container
ports:
- "3001:3001"
environment:
- FLASK_ENV=development
depends_on:
mysql-service:
condition: service_healthy # Web waits for DB to be healthy before starting
networks:
- app_network
volumes:
- .:/app
restart: always
mysql-service:
image: mysql:latest # MySQL image with the latest tag
restart: always
container_name: mysql-container # Simplified container name
environment:
MYSQL_DATABASE: mysql_db # Changed to generic DB name for tutorial purposes
MYSQL_ROOT_PASSWORD: password # Generic password
volumes:
- mysql_volume:/var/lib/mysql # Volume for persistent DB storage
- ./scripts:/docker-entrypoint-initdb.d # Scripts to initialize the DB
networks:
- app_network # Updated network name for consistency
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 3 # Healthcheck to ensure the DB is ready
volumes:
mysql_volume: # Persistent volume for MySQL data
networks:
app_network: # Updated network name to make it tutorial-friendly
driver: bridge