# NVIDIA PyTorch container with Python 3.12 and CUDA support FROM nvcr.io/nvidia/pytorch:24.12-py3 # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ DEBIAN_FRONTEND=noninteractive # Install system dependencies and uv RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ curl \ portaudio19-dev \ libasound2-dev \ libsndfile1-dev \ git \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Install uv (much faster than pip) RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.local/bin:$PATH" # Copy project files WORKDIR /app COPY pyproject.toml ./ COPY . /app/ # Install dependencies with uv (much faster) RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --system --no-deps \ "discord.py>=2.4.0" \ "openai>=1.40.0" \ "anthropic>=0.34.0" \ "groq>=0.9.0" \ "asyncpg>=0.29.0" \ "redis>=5.1.0" \ "qdrant-client>=1.12.0" \ "pydantic>=2.8.0" \ "aiohttp>=3.10.0" \ "python-dotenv>=1.0.1" \ "tenacity>=9.0.0" \ "distro>=1.9.0" \ "alembic>=1.13.0" \ "elevenlabs>=2.12.0" \ "azure-cognitiveservices-speech>=1.45.0" \ "aiohttp-cors>=0.8.0" \ "httpx>=0.27.0" \ "requests>=2.32.0" \ "pydantic-settings>=2.4.0" \ "prometheus-client>=0.20.0" \ "psutil>=6.0.0" \ "cryptography>=43.0.0" \ "bcrypt>=4.2.0" \ "click>=8.1.0" \ "colorlog>=6.9.0" \ "python-dateutil>=2.9.0" \ "pytz>=2024.2" \ "orjson>=3.11.0" \ "watchdog>=6.0.0" \ "aiofiles>=24.0.0" \ "websockets>=13.0" \ "anyio>=4.6.0" \ "structlog>=24.0.0" \ "rich>=13.9.0" \ "webrtcvad>=2.0.10" \ "ffmpeg-python>=0.2.0" \ "resampy>=0.4.3" \ "pydub>=0.25.1" \ "mutagen>=1.47.0" \ "pyyaml>=6.0.2" \ "typing-extensions>=4.0.0" \ "typing_inspection>=0.4.1" \ "annotated-types>=0.4.0" && \ uv pip install --system --no-deps -e . && \ uv pip install --system \ "sentence-transformers>=3.0.0" \ "pyannote.audio>=3.3.0" \ "discord-ext-voice-recv" # Create directories and set permissions RUN mkdir -p /app/data /app/logs /app/temp /app/config /app/models && \ useradd -r -s /bin/false -m -d /app appuser && \ chown -R appuser:appuser /app # Switch to non-root user for security USER appuser # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # Default command CMD ["python", "main.py"] # Development stage FROM nvcr.io/nvidia/pytorch:24.12-py3 as development # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ DEBIAN_FRONTEND=noninteractive # Install system dependencies + dev tools RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ curl \ portaudio19-dev \ libasound2-dev \ libsndfile1-dev \ git \ vim-tiny \ nano \ htop \ procps \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Install uv (much faster than pip) RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.local/bin:$PATH" # Copy project files WORKDIR /app COPY pyproject.toml ./ COPY . /app/ # Install Python dependencies with dev/test groups using uv (much faster) RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --system --break-system-packages --no-deps \ "discord.py>=2.4.0" \ "openai>=1.40.0" \ "anthropic>=0.34.0" \ "groq>=0.9.0" \ "asyncpg>=0.29.0" \ "redis>=5.1.0" \ "qdrant-client>=1.12.0" \ "pydantic>=2.8.0" \ "aiohttp>=3.10.0" \ "python-dotenv>=1.0.1" \ "tenacity>=9.0.0" \ "distro>=1.9.0" \ "alembic>=1.13.0" \ "elevenlabs>=2.12.0" \ "azure-cognitiveservices-speech>=1.45.0" \ "aiohttp-cors>=0.8.0" \ "httpx>=0.27.0" \ "requests>=2.32.0" \ "pydantic-settings>=2.4.0" \ "prometheus-client>=0.20.0" \ "psutil>=6.0.0" \ "cryptography>=43.0.0" \ "bcrypt>=4.2.0" \ "click>=8.1.0" \ "colorlog>=6.9.0" \ "python-dateutil>=2.9.0" \ "pytz>=2024.2" \ "orjson>=3.11.0" \ "watchdog>=6.0.0" \ "aiofiles>=24.0.0" \ "websockets>=13.0" \ "anyio>=4.6.0" \ "structlog>=24.0.0" \ "rich>=13.9.0" \ "webrtcvad>=2.0.10" \ "ffmpeg-python>=0.2.0" \ "resampy>=0.4.3" \ "pydub>=0.25.1" \ "mutagen>=1.47.0" \ "pyyaml>=6.0.2" \ "basedpyright>=1.31.3" \ "pyrefly>=0.30.0" \ "pyright>=1.1.404" \ "ruff>=0.12.10" \ "pytest>=7.4.0" \ "pytest-asyncio>=0.21.0" \ "pytest-cov>=4.1.0" \ "pytest-mock>=3.11.0" \ "pytest-xdist>=3.3.0" \ "pytest-benchmark>=4.0.0" \ "typing-extensions>=4.0.0" \ "typing_inspection>=0.4.1" \ "annotated-types>=0.4.0" && \ uv pip install --system --break-system-packages --no-deps -e . && \ uv pip install --system --break-system-packages \ "sentence-transformers>=3.0.0" \ "pyannote.audio>=3.3.0" \ "discord-ext-voice-recv" # Create directories and set permissions RUN mkdir -p /app/data /app/logs /app/temp /app/config /app/models # Development runs as root for convenience USER root # Development command CMD ["python", "-u", "main.py"]