-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
102 lines (97 loc) · 2.6 KB
/
Copy pathdocker-compose.yml
File metadata and controls
102 lines (97 loc) · 2.6 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
services:
redis:
image: redis:7
container_name: auth_redis
restart: unless-stopped
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- app_network
db:
image: postgres:16
container_name: auth_postgres
restart: unless-stopped
env_file:
- .env.dev
environment:
POSTGRES_DB: ${DATABASE_NAME}
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${DATABASE_PORT}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DATABASE_USER} -d ${DATABASE_NAME}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- app_network
backend:
build:
context: .
dockerfile: docker/Dockerfile.dev
container_name: auth_backend
restart: unless-stopped
# command: gunicorn src.main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 --timeout 120 --access-logfile - --error-logfile -
command: uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir /app/src
env_file:
- .env.dev
environment:
HOME: /tmp
DATABASE_HOST: db
DATABASE_PORT: 5432
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_USER: ${DATABASE_USER}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
SECRET_KEY: ${SECRET_KEY}
ALGORITHM: ${ALGORITHM}
ACCESS_TOKEN_LIFETIME_DAYS: ${ACCESS_TOKEN_LIFETIME_DAYS}
REFRESH_TOKEN_LIFETIME_DAYS: ${REFRESH_TOKEN_LIFETIME_DAYS}
REDIS_URL: redis://redis:6379/0
SERVICE_NAME: ${SERVICE_NAME}
SERVICE_HOST: 0.0.0.0
SERVICE_PORT: 8000
OPENAPI_URL: ${OPENAPI_URL}
ports:
- "0.0.0.0:${SERVICE_PORT}:8000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- .:/app
networks:
- app_network
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
nginx:
image: nginx:mainline-alpine3.23
container_name: api_nginx
restart: unless-stopped
ports:
- "0.0.0.0:80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
backend:
condition: service_healthy
networks:
- app_network
volumes:
postgres_data:
networks:
app_network:
driver: bridge