| FROM python:3.10-slim | |
| # Install system build dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Upgrade pip and install PyTorch CPU first to cache it (saves 2.5GB download and build time) | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu | |
| # Copy python packaging and source files | |
| COPY ./pyproject.toml ./pyproject.toml | |
| COPY ./README.md ./README.md | |
| COPY ./pocket_tts ./pocket_tts | |
| COPY ./s2s_server.py ./s2s_server.py | |
| COPY ./models ./models | |
| COPY ./queues ./queues | |
| COPY ./runtime ./runtime | |
| COPY ./services ./services | |
| COPY ./middleware ./middleware | |
| # Install dependencies and local pocket-tts package | |
| RUN pip install --no-cache-dir -e . && \ | |
| pip install --no-cache-dir openai groq websockets uvicorn python-dotenv | |
| # Expose ports for both local, Render, and Hugging Face Spaces (which uses 7860) | |
| ENV PORT=7860 | |
| EXPOSE 8000 | |
| EXPOSE 7860 | |
| # Run the S2S server | |
| CMD ["python", "s2s_server.py"] | |