Skip to content

Commit d4a0fce

Browse files
committed
Refactor docker-compose.yml; improve healthcheck and streamline backend service configuration
1 parent d7d24e8 commit d4a0fce

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

docker-compose.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ services:
1414
- POSTGRES_DB=${DB_NAME}
1515
ports:
1616
- "5432:5432"
17-
# Healthcheck: Dokter yang ngecek DB sudah siap belum
1817
healthcheck:
19-
# KOREKSI: Pakai variabel environment biar sinkron sama .env
2018
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
2119
interval: 5s
2220
timeout: 5s
@@ -31,32 +29,28 @@ services:
3129

3230
# --- SERVICE BACKEND (FastAPI) ---
3331
web:
34-
# KOREKSI 1: Matikan build manual, kita pakai Image dari GitHub
35-
# build: .
36-
37-
# KOREKSI 2: Ganti username_github jadi username asli
32+
# Pakai Image dari GitHub Container Registry
3833
image: ghcr.io/bagus-devlab/pcb-backend-api:latest
3934

4035
container_name: iot_fastapi
4136
restart: always
4237

43-
# KOREKSI 3: Hilangkan --reload untuk production (biar enteng)
38+
# Perintah start server
4439
command: uvicorn app.main:app --host 0.0.0.0 --port 8000
45-
40+
4641
environment:
4742
- REDIS_URL=redis://redis:6379/0
48-
49-
# KOREKSI 4: Matikan mounting volume code, biar dia pake code yg ada di dalam Image
50-
# volumes:
51-
# - ./app:/code/app
52-
43+
44+
# PERBAIKAN: Spasi sudah diratakan & Mapping spesifik file saja
45+
volumes:
46+
- ./app/serviceAccountKey.json:/code/app/serviceAccountKey.json
47+
5348
ports:
54-
# KOREKSI 5: Host Port ganti 8006 (karena 8000 dipake Portainer)
5549
- "8006:8000"
56-
50+
5751
env_file:
5852
- .env
59-
53+
6054
depends_on:
6155
db:
6256
condition: service_healthy

0 commit comments

Comments
 (0)