- Create Dockerfile with Python 3.10 base image - Install system dependencies (espeak-ng) for Kokoro TTS - Install Python dependencies from requirements.txt - Copy backend code and expose port 8000 - Configure Uvicorn server startup - Add docker-compose.yml for easy orchestration - Include health checks and environment variables - Add .dockerignore to optimize build context Implements task 6 - Requirements 11.1-11.6
25 lines
627 B
YAML
25 lines
627 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: text-to-audiobook-backend
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- PORT=8000
|
|
- LOG_LEVEL=info
|
|
volumes:
|
|
# Mount code for development (optional - comment out for production)
|
|
- ./services:/app/services
|
|
- ./main.py:/app/main.py
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|