-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
51 lines (51 loc) · 1.28 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
version: '3.9'
services:
backend:
container_name: cash_force
entrypoint: ["/bin/bash", "-c", "sleep 30 && npm start"]
build: .
ports:
- 3001:3001
depends_on:
db:
condition: service_healthy
environment:
- PORT=3001
# Os dados abaixo se referem ao container `db`
- DB_USER=root
- DB_PASS=123456
- DB_HOST=db
- MYSQL_DB_NAME=cash-force
- DB_PORT=3306
healthcheck:
test: ["CMD", "lsof", "-t", "-i:3001"] # Caso utilize outra porta interna para o back, altere ela aqui também
timeout: 10s
retries: 5
migration:
container_name: cash_force_migration
build: .
depends_on:
db:
condition: service_healthy
environment:
- PORT=3001
- DB_USER=root
- DB_PASS=123456
- DB_HOST=db
- MYSQL_DB_NAME=cash-force
- DB_PORT=3306
entrypoint: ["npm", "run", "db:reset" ]
db:
image: mysql:5.7
container_name: db
ports:
- 3002:3306
environment:
- MYSQL_ROOT_PASSWORD=123456
restart: 'always'
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-p123456"] # Deve aguardar o banco ficar operacional
timeout: 10s
retries: 5
cap_add:
- SYS_NICE # Deve omitir alertas menores