-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
162 lines (150 loc) · 3.88 KB
/
docker-compose.yml
File metadata and controls
162 lines (150 loc) · 3.88 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: ra_d_ps_postgres
environment:
POSTGRES_DB: ra_d_ps_db
POSTGRES_USER: ra_d_ps_user
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=en_US.UTF-8"
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ra_d_ps_user -d ra_d_ps_db"]
interval: 10s
timeout: 5s
retries: 5
networks:
- ra_d_ps_network
restart: unless-stopped
# pgAdmin (optional - for database management UI)
pgadmin:
image: dpage/pgadmin4:latest
container_name: ra_d_ps_pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@ra-d-ps.local}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "5050:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
networks:
- ra_d_ps_network
depends_on:
- postgres
restart: unless-stopped
profiles:
- dev # Only start with: docker-compose --profile dev up
# FastAPI Application
api:
build:
context: .
dockerfile: Dockerfile
container_name: ra_d_ps_api
environment:
# Database connection
DATABASE_URL: postgresql://ra_d_ps_user:${POSTGRES_PASSWORD:-changeme}@postgres:5432/ra_d_ps_db
# Application settings
APP_ENV: ${APP_ENV:-development}
LOG_LEVEL: ${LOG_LEVEL:-INFO}
# File storage
UPLOAD_DIR: /app/uploads
PROFILE_DIR: /app/profiles
# API configuration
API_HOST: 0.0.0.0
API_PORT: 8000
WORKERS: ${API_WORKERS:-4}
# CORS configuration
CORS_ORIGINS: http://localhost:3000,http://web:3000
ports:
- "8000:8000"
volumes:
- ./src:/app/src:ro
- ./profiles:/app/profiles
- uploads:/app/uploads
- ./logs:/app/logs
networks:
- ra_d_ps_network
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
command: uvicorn src.ra_d_ps.api.main:app --host 0.0.0.0 --port 8000 --reload
profiles:
- api # Only start with: docker-compose --profile api up
# React Web Interface
web:
build:
context: ./web
dockerfile: Dockerfile
target: development
container_name: ra_d_ps_web
environment:
VITE_API_URL: http://localhost:8000
ports:
- "3000:3000"
volumes:
- ./web/src:/app/src
- ./web/public:/app/public
networks:
- ra_d_ps_network
depends_on:
- api
restart: unless-stopped
profiles:
- web # Only start with: docker-compose --profile web up
# Nginx (optional - for production reverse proxy)
nginx:
image: nginx:alpine
container_name: ra_d_ps_nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
networks:
- ra_d_ps_network
depends_on:
- api
restart: unless-stopped
profiles:
- production # Only for production deployment
networks:
ra_d_ps_network:
driver: bridge
name: ra_d_ps_network
volumes:
postgres_data:
driver: local
name: ra_d_ps_postgres_data
pgadmin_data:
driver: local
name: ra_d_ps_pgadmin_data
uploads:
driver: local
name: ra_d_ps_uploads
# Usage:
# Development (PostgreSQL only):
# docker-compose up -d postgres
#
# Development with pgAdmin:
# docker-compose --profile dev up -d
#
# Development with API:
# docker-compose --profile api up -d
#
# Production:
# docker-compose --profile production up -d
#
# Stop all services:
# docker-compose down
#
# Stop and remove volumes (⚠️ deletes all data):
# docker-compose down -v