Add FastAPI application, API endpoints, Celery workers, and Docker configuration
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# PostgreSQL Database
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: pop3-postgres
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: pop3_forwarder
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Redis for caching and Celery
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: pop3-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# FastAPI Backend
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: pop3-backend
|
||||
ports:
|
||||
- "8000:8000"
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
restart: unless-stopped
|
||||
|
||||
# Celery Worker for background email processing
|
||||
celery-worker:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: pop3-celery-worker
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
- backend
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
command: celery -A app.workers.celery_app worker --loglevel=info
|
||||
restart: unless-stopped
|
||||
|
||||
# Celery Beat for scheduling
|
||||
celery-beat:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: pop3-celery-beat
|
||||
env_file:
|
||||
- ./backend/.env
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
- backend
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
command: celery -A app.workers.celery_app beat --loglevel=info
|
||||
restart: unless-stopped
|
||||
|
||||
# Frontend (React/Next.js) - to be implemented
|
||||
# frontend:
|
||||
# build:
|
||||
# context: ./frontend
|
||||
# dockerfile: Dockerfile
|
||||
# container_name: pop3-frontend
|
||||
# ports:
|
||||
# - "3000:3000"
|
||||
# depends_on:
|
||||
# - backend
|
||||
# volumes:
|
||||
# - ./frontend:/app
|
||||
# - /app/node_modules
|
||||
# restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
Reference in New Issue
Block a user