version: '3.8' services: # PostgreSQL database postgres: image: postgres:15-alpine container_name: marketplace-db environment: POSTGRES_USER: marketplace POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme123} POSTGRES_DB: marketplace volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U marketplace"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped # Redis cache (optional, for future features) redis: image: redis:7-alpine container_name: marketplace-redis ports: - "6379:6379" volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped # FastAPI application app: build: context: . dockerfile: Dockerfile container_name: marketplace-app environment: # Server PORT: 3000 # Database DATABASE_URL: postgresql://marketplace:${POSTGRES_PASSWORD:-changeme123}@postgres:5432/marketplace # Model MODEL_REPO_ID: unsloth/Qwen3-4B-Instruct-2507 HF_TOKEN: ${HF_TOKEN:-} EAGER_LOAD_MODEL: ${EAGER_LOAD_MODEL:-1} # Inference MAX_TOKENS: 4096 TEMPERATURE: 0.7 DEVICE_MAP: auto TORCH_DTYPE: auto # Authentication JWT_SECRET_KEY: ${JWT_SECRET_KEY:-your-super-secret-jwt-key-change-in-production} ACCESS_TOKEN_EXPIRE_MINUTES: 30 REFRESH_TOKEN_EXPIRE_DAYS: 7 # Session persistence PERSIST_SESSIONS: 1 SESSIONS_DB_PATH: sessions.db SESSIONS_TTL_SECONDS: 600 # Redis (future) REDIS_URL: redis://redis:6379/0 ports: - "3000:3000" volumes: - ./marketplace.db:/app/marketplace.db - ./sessions.db:/app/sessions.db - hf_cache:/app/hf-cache depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] interval: 30s timeout: 10s retries: 3 start_period: 120s restart: unless-stopped # Nginx reverse proxy (optional, for production) nginx: image: nginx:alpine container_name: marketplace-nginx ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./ssl:/etc/nginx/ssl:ro depends_on: - app restart: unless-stopped volumes: postgres_data: driver: local redis_data: driver: local hf_cache: driver: local