-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
64 lines (58 loc) · 1.51 KB
/
docker-compose.yml
File metadata and controls
64 lines (58 loc) · 1.51 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
version: '3.8'
services:
# MongoDB Database
mongodb:
image: mongo:7.0
container_name: fastapi-mongodb
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin123
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
networks:
- fastapi-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
# FastAPI Application
api:
build:
context: .
dockerfile: Dockerfile
container_name: fastapi-api
restart: unless-stopped
environment:
# Security Settings
SECRET_KEY: your-secret-key-change-in-production
ALGORITHM: HS256
ACCESS_TOKEN_EXPIRE_MINUTES: 480
# MongoDB Settings
MONGO_DATABASE_NAME: fastapi_db
MONGO_USERNAME: admin
MONGO_PASSWORD: admin123
MONGO_HOST: mongodb
MONGO_PORT: 27017
# Redis Settings (if needed in future)
REDIS_URL: redis://redis:6379/0
ports:
- "8000:8000"
depends_on:
mongodb:
condition: service_healthy
networks:
- fastapi-network
volumes:
- ./app:/app/app # Mount app directory for hot reload in development
- artifact_storage:/app/storage # Persistent storage for artifacts
command: uv run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
networks:
fastapi-network:
driver: bridge
volumes:
mongodb_data:
artifact_storage: