# ============================================ # Audiobook Maker Pro v4 - Production Dockerfile # CPU-only build — no CUDA/MPS dependencies # ============================================ FROM python:3.11-slim # Install system dependencies for pydub (ffmpeg), python-docx, olefile, PyMuPDF RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libmupdf-dev \ libfreetype6 \ libharfbuzz0b \ libjpeg62-turbo \ libopenjp2-7 \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy requirements first for better layer caching COPY requirements.txt . # Install Python dependencies — CPU only, no CUDA RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create the persistent data directory at build time # (Coolify volume mount will overlay this at runtime) RUN mkdir -p /opt/apps/audiobook-maker-pro-v4 # Expose the application port EXPOSE 5009 # Health check — Coolify uses this to determine container readiness HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:5009/login')" || exit 1 # Run with gunicorn for production CMD ["gunicorn", \ "--bind", "0.0.0.0:5009", \ "--workers", "3", \ "--threads", "2", \ "--timeout", "300", \ "--worker-class", "gthread", \ "--access-logfile", "-", \ "--error-logfile", "-", \ "app:app"]