-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
147 lines (140 loc) · 4.44 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
147 lines (140 loc) · 4.44 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: thz-imob
services:
# ---------------------------------------------------------------------------
# PostgreSQL 16 — Banco de Dados Relacional
# ---------------------------------------------------------------------------
postgres:
image: postgres:16
container_name: thz-postgres
restart: unless-stopped
environment:
POSTGRES_USER: thz
POSTGRES_PASSWORD: thz_pass123
POSTGRES_DB: thz_minhaimob
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U thz -d thz_minhaimob"]
interval: 5s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Redis 7 — Cache e Gerenciamento de Sessão/Fila
# ---------------------------------------------------------------------------
redis:
image: redis:7
container_name: thz-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# MinIO — S3 Compatible Object Storage
# ---------------------------------------------------------------------------
minio:
image: minio/minio:latest
container_name: thz-minio
restart: unless-stopped
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ports:
- "9000:9000" # API S3
- "9001:9001" # Console Web
command: server /data --console-address ":9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9000/minio/health/live || exit 1"]
interval: 5s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Helper MinIO — Criação automática de Buckets público e privado
# ---------------------------------------------------------------------------
minio-init:
image: minio/mc:latest
container_name: thz-minio-init
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
echo 'Aguardando MinIO iniciar...';
until /usr/bin/mc config host add myminio http://minio:9000 minioadmin minioadmin; do sleep 1; done;
/usr/bin/mc mb --ignore-existing myminio/thz-public;
/usr/bin/mc mb --ignore-existing myminio/thz-private;
/usr/bin/mc anonymous set public myminio/thz-public;
echo 'Buckets MinIO configurados com sucesso!';
exit 0;
"
# ---------------------------------------------------------------------------
# Backend API — NestJS 11
# ---------------------------------------------------------------------------
api:
container_name: thz-api
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
target: api
ports:
- "3333:3333"
environment:
DATABASE_URL: postgresql://thz:thz_pass123@postgres:5432/thz_minhaimob?schema=public
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_PASSWORD: ""
S3_ENDPOINT: http://minio:9000
S3_REGION: us-east-1
S3_ACCESS_KEY: minioadmin
S3_SECRET_KEY: minioadmin
S3_BUCKET_PUBLIC: thz-public
S3_BUCKET_PRIVATE: thz-private
S3_FORCE_PATH_STYLE: "true"
API_PORT: 3333
API_GLOBAL_PREFIX: api/v1
NODE_ENV: production
JWT_ACCESS_SECRET: change-me-access-secret-min-32-chars
JWT_REFRESH_SECRET: change-me-refresh-secret-min-32-chars
JWT_ACCESS_TTL: 900s
JWT_REFRESH_TTL: 7d
APP_ENCRYPTION_KEY: change-me-32-byte-encryption-key
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
# ---------------------------------------------------------------------------
# Frontend Web — Next.js 15
# ---------------------------------------------------------------------------
web:
container_name: thz-web
restart: unless-stopped
build:
context: .
dockerfile: Dockerfile
target: web
ports:
- "3000:3000"
environment:
NEXT_PUBLIC_API_URL: http://localhost:3333/api/v1
NEXT_PUBLIC_APP_NAME: THZ Imob
NODE_ENV: production
depends_on:
api:
condition: service_started
volumes:
postgres_data:
redis_data:
minio_data: