-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
129 lines (120 loc) · 2.78 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
129 lines (120 loc) · 2.78 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
version: '3.8'
services:
# Database (PostgreSQL)
postgres:
image: postgres
container_name: postgres_container
environment:
POSTGRES_USER: ${POSTGRES_USER:-admin}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
PGDATA: /var/lib/postgresql/data
ports:
- '5432:5432'
restart: unless-stopped
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- app-network
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-admin} -d postgres']
interval: 10s
timeout: 5s
retries: 3
# PGAdmin (Database UI)
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@admin.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-password}
PGADMIN_CONFIG_SERVER_MODE: 'False'
restart: always
ports:
- '5050:80'
volumes:
- pgadmin_data:/root/.pgadmin
networks:
- app-network
# Redis Master
redis:
image: redis:latest
container_name: master
command: bash -c "redis-server --appendonly yes"
ports:
- '6379:6379'
volumes:
- redis-data:/data
networks:
- app-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
# Redis Slave
redis-slave:
image: redis:latest
container_name: slave
ports:
- '6380:6379'
command: redis-server --replicaof master 6379
depends_on:
redis:
condition: service_healthy
networks:
- app-network
# Redis Commander (GUI)
redis-commander:
image: rediscommander/redis-commander:latest
container_name: redis-commander
environment:
- REDIS_HOSTS=master,slave
- REDIS_PORTS=6379,6380
ports:
- "8081:8081"
depends_on:
redis:
condition: service_healthy
networks:
- app-network
# API (Dotnet)
api:
build:
context: ./Server
dockerfile: ./API/Host/Dockerfile
container_name: dotnet-api
ports:
- '8080:8080'
depends_on:
postgres:
condition: service_healthy
environment:
- DOTNET_ENVIRONMENT=PROD
- ConnectionStrings__DefaultConnection=${DB_CONNECTION_STRING}
- ConnectionStrings__Redis=${REDIS_CONNECTION}
networks:
- app-network
# Client (React - Vite - TypeScipt)
client:
build:
context: ./Client
dockerfile: Dockerfile
args:
- VITE_API_BASE_URL=${VITE_API_BASE_URL}
container_name: react-client
ports:
- '3000:80'
depends_on:
- api
environment:
- NODE_ENV=PROD
networks:
- app-network
volumes:
postgres_data:
pgadmin_data:
redis-data:
driver: local
networks:
app-network:
driver: bridge