-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
90 lines (85 loc) · 2.36 KB
/
docker-compose.yml
File metadata and controls
90 lines (85 loc) · 2.36 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
# Docker Compose for Pulsefeed Development (PostgreSQL-only)
#
# USAGE:
# Start everything: docker-compose up
# Start in background: docker-compose up -d
# View logs: docker-compose logs -f app
# Run migrations: docker-compose run --rm app alembic upgrade head
# Stop everything: docker-compose down
#
# FIRST TIME SETUP:
# 1. docker-compose up -d db # Start database first
# 2. docker-compose run --rm migrate # Run migrations
# 3. docker-compose up app # Start app
services:
# Flask Application (PostgreSQL)
app:
build:
context: .
dockerfile: Dockerfile.dev
container_name: pulsefeed_app
environment:
- FLASK_ENV=development
- FLASK_DEBUG=1
- PORT=${PORT:-1994}
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production}
- DB_ENCRYPTION_KEY=${DB_ENCRYPTION_KEY}
- SQLALCHEMY_DATABASE_URI=postgresql://pulsefeed:localdev@db:5432/pulsefeed
volumes:
# Mount source code for hot reloading
- .:/app
# Don't override these in container
- /app/__pycache__
- /app/.pytest_cache
- /app/venv
ports:
- "${PORT:-1994}:${PORT:-1994}"
depends_on:
db:
condition: service_healthy
command: python app.py
# PostgreSQL Database
db:
image: postgres:15-alpine
container_name: pulsefeed_db
environment:
POSTGRES_USER: pulsefeed
POSTGRES_PASSWORD: localdev
POSTGRES_DB: pulsefeed
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5433:5432" # Use 5433 externally to avoid conflicts
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pulsefeed"]
interval: 5s
timeout: 5s
retries: 5
# Redis (optional - use with --profile redis)
redis:
image: redis:7-alpine
container_name: pulsefeed_redis
profiles:
- redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# One-off migration runner
migrate:
build:
context: .
dockerfile: Dockerfile.dev
environment:
- SQLALCHEMY_DATABASE_URI=postgresql://pulsefeed:localdev@db:5432/pulsefeed
volumes:
- .:/app
depends_on:
db:
condition: service_healthy
command: alembic upgrade head
volumes:
postgres_data: