-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
64 lines (58 loc) · 1.51 KB
/
docker-compose.yml
File metadata and controls
64 lines (58 loc) · 1.51 KB
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
59
60
61
62
63
64
networks:
chat-net:
volumes:
db_data:
services:
############ MySQL ############
db:
build:
context: ./docker/db
dockerfile: Dockerfile
container_name: websocket_db
ports:
- "3308:3306" # host:container
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: websocket
MYSQL_USER: websocket_user
MYSQL_PASSWORD: 06022003
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p06022003"]
interval: 10s
timeout: 5s
retries: 10
volumes:
- db_data:/var/lib/mysql
networks: [ chat-net ]
############ Redis (sessions / cache / presença) ############
redis:
image: redis:8-alpine
container_name: websocket_redis
ports:
- "6379:6379"
networks: [ chat-net ]
############ Spring Boot API ############
api:
build:
context: .
dockerfile: ./docker/api/Dockerfile
container_name: websocket_api
depends_on:
db: { condition: service_healthy }
redis: { condition: service_started }
env_file:
- .env # mantém secrets externos (AWS, OAuth, etc.)
environment:
# sobrescreve apenas o que é local
SPRING_PROFILES_ACTIVE: docker
SERVER_PORT: 8080
DB_HOST: db
DB_PORT: 3306
DB_NAME: websocket
DB_USERNAME: websocket_user
DB_PASSWORD: 06022003
REDIS_HOST: redis
REDIS_PORT: 6379
ports:
- "8081:8080" # host -> container
networks: [ chat-net ]