forked from tombihoreau/API-Badminton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
57 lines (55 loc) · 1.29 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
services:
# La web API (Node.js)
api:
build:
context: .
dockerfile: Dockerfile
restart: always
labels:
- "autoheal=true"
container_name: ${PROJECT_NAME}-api
ports:
- "${HOST_PORT_API}:3000"
depends_on:
db:
condition: service_healthy
restart: true
healthcheck:
test: ["CMD", "mysqladmin", "-hdb", "-P3306", "ping", "--silent"]
interval: 10s
timeout: 10s
retries: 10
command: ["sh", "-c", "sleep 5 && npx nodemon ./bin/www"]
volumes:
- ./config:/usr/src/app/config
- .:/usr/src/app
# La base de données MySQL
db:
image: mysql:8
restart: always
labels:
- "autoheal=true"
environment:
- MYSQL_DATABASE=mydb
- MYSQL_USER=user
- MYSQL_PASSWORD=password
- MYSQL_ROOT_PASSWORD=root
volumes:
- ./dbdata:/var/lib/mysql
ports:
- "${HOST_PORT_DB}:3306"
container_name: ${PROJECT_NAME}-db
healthcheck:
test: ["CMD", "mysqladmin", "ping", "--silent"]
interval: 5s
timeout: 5s
retries: 5
# L'interface Adminer pour gérer la base de données
adminer:
image: adminer
restart: always
depends_on:
- db
container_name: ${PROJECT_NAME}-adminer
ports:
- "${HOST_PORT_ADMINER}:8080"