-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
74 lines (70 loc) · 1.89 KB
/
Copy pathcompose.yaml
File metadata and controls
74 lines (70 loc) · 1.89 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
#'Kullanım:
#' Geliştirme : docker compose up -d
#' Production : docker compose --profile prod up -d
#' Sadece DB : docker compose up -d db
#' Logları görüntülemek için : docker logs -d api
services:
db:
image: postgres:17-alpine
container_name: devtv-db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-devtv}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD gerekli}
POSTGRES_DB: ${POSTGRES_DB:-devtv}
ports:
- "5432:5432" #' PostgreSQL'in default portları bırakılmıştır. Hosts Port - Containers Port şeklindedir.
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-devtv} -d ${POSTGRES_DB:-devtv}" ]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
networks:
- devtv-net
# YENİ: Redis Servisi
redis:
image: redis:alpine
container_name: devtv-redis
restart: unless-stopped
ports:
- "6379:6379"
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 5s
timeout: 3s
retries: 5
networks:
- devtv-net
api:
build:
context: .
dockerfile: Dockerfile
container_name: devtv-api
restart: unless-stopped
depends_on:
db:
condition: service_healthy
# YENİ: Go API artık Redis'in de hazır olmasını bekleyecek
redis:
condition: service_healthy
ports:
- "${API_PORT:-2012}:2012"
environment:
dsn: "host=db user=${POSTGRES_USER:-devtv} password=${POSTGRES_PASSWORD} dbname=${POSTGRES_DB:-devtv} port=5432 sslmode=disable"
volumes:
- ./in/devtv.env:/in/devtv.env:ro
- ./conf.yaml:/conf.yaml:ro
- devtv-logs:/logs
networks:
- devtv-net
volumes:
pgdata:
driver: local
devtv-logs:
driver: local
networks:
devtv-net:
driver: bridge