-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
37 lines (37 loc) · 1 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
services:
backend:
build: backend
container_name: store_manager
ports:
- 3001:3001 # porta padrão da aplicação
- 9229:9229 # porta para debugging
command: run dev # roda aplicação com nodemon
volumes:
# vincula pasta local com a dentro do container
- ./backend/src:/app/src
- ./backend/tests:/app/tests
environment:
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_HOSTNAME: db
MYSQL_PORT: 3306
PORT: 3001
depends_on:
db:
condition: service_healthy
db:
image: mysql:8.0.32
container_name: store_manager_db
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: StoreManager
ports:
- 3306:3306
healthcheck:
# Deve aguardar o banco ficar operacional
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 10s
retries: 5
volumes:
# adiciona scripts SQL para serem executados ao iniciar a DB
- ./sql:/docker-entrypoint-initdb.d