Files
office_translator/docker-compose.dev.yml
Sepehr Ramezani 26bd096a06 feat: production deployment - full update with providers, admin, glossaries, pricing, tests
Major changes across backend, frontend, infrastructure:
- Provider system with model selection (Google, DeepL, OpenAI, Ollama, Google Cloud)
- Admin panel: user management, pricing, settings
- Glossary system with CSV import/export
- Subscription and tier quota management
- Security hardening (rate limiting, API key auth, path traversal fixes)
- Docker compose for dev, prod, and IONOS deployment
- Alembic migrations for new tables
- Frontend: dashboard, pricing page, landing page, i18n (en/fr)
- Test suite and verification scripts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-25 15:01:47 +02:00

141 lines
4.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Document Translation API - Development Docker Compose
# Usage: docker compose -f docker-compose.dev.yml up
# (or: docker-compose -f docker-compose.dev.yml up)
#
# Starts: backend (FastAPI :8000), frontend (Next.js :3000), PostgreSQL, Redis
# Hot reload: backend and frontend code mounted as volumes
# Environment: loaded from .env at project root (env_file and Compose substitution)
version: '3.8'
services:
# ===========================================
# PostgreSQL Database
# ===========================================
postgres:
image: postgres:16-alpine
container_name: translate-postgres-dev
environment:
- POSTGRES_USER=${POSTGRES_USER:-translate}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-translate_secret_123}
- POSTGRES_DB=${POSTGRES_DB:-translate_db}
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- postgres_data_dev:/var/lib/postgresql/data
networks:
- translate-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-translate} -d ${POSTGRES_DB:-translate_db}"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
# ===========================================
# Redis
# ===========================================
redis:
image: redis:7-alpine
container_name: translate-redis-dev
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data_dev:/data
networks:
- translate-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
# ===========================================
# Backend API (FastAPI) - hot reload
# ===========================================
backend:
build:
context: .
dockerfile: docker/backend/Dockerfile
target: builder
container_name: translate-backend-dev
env_file:
- .env
environment:
- DEBUG=true
- LOG_LEVEL=DEBUG
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-translate}:${POSTGRES_PASSWORD:-translate_secret_123}@postgres:5432/${POSTGRES_DB:-translate_db}
- REDIS_URL=redis://redis:6379/0
volumes:
- .:/app
- backend_venv:/opt/venv
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
ports:
- "8000:8000"
networks:
- translate-network
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8000/health')\" || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
# ===========================================
# Frontend (Next.js) - hot reload
# ===========================================
frontend:
build:
context: .
dockerfile: docker/frontend/Dockerfile
target: builder
args:
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:8000}
container_name: translate-frontend-dev
env_file:
- .env
environment:
- NODE_ENV=development
# Proxy Next : navigateur → /api/* → backend (évite CORS et lhostname `backend` côté client)
- BACKEND_URL=http://backend:8000
# Vide = URLs relatives + proxy. Sinon URL joignable depuis le navigateur (ex. http://localhost:8000)
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-}
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
- frontend_next:/app/.next
command: npm run dev
ports:
- "3000:3000"
networks:
- translate-network
depends_on:
backend:
condition: service_healthy
# ===========================================
# Networks
# ===========================================
networks:
translate-network:
driver: bridge
# ===========================================
# Volumes (dev-only names to avoid clashing with prod)
# ===========================================
volumes:
postgres_data_dev:
driver: local
redis_data_dev:
driver: local
backend_venv:
driver: local
frontend_node_modules:
driver: local
frontend_next:
driver: local