# AI Agency Pro - Full Lifecycle Dockerfile # Optimized for GPU inference with transformers # Stage 1: Base with CUDA support FROM nvidia/cuda:12.1-runtime-ubuntu22.04 AS base # Prevent interactive prompts ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Install system dependencies RUN apt-get update && apt-get install -y \ python3.11 \ python3.11-venv \ python3-pip \ git \ curl \ && rm -rf /var/lib/apt/lists/* # Install uv (fastest Python package manager) RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.cargo/bin:$PATH" # Stage 2: Dependencies FROM base AS dependencies WORKDIR /app # Copy dependency files COPY pyproject.toml requirements.txt ./ # Install dependencies with uv (10x faster than pip) RUN uv pip install --system -r requirements.txt # Stage 3: Application FROM dependencies AS application # Copy application code COPY . . # Create non-root user for security RUN useradd -m -u 1000 appuser RUN chown -R appuser:appuser /app USER appuser # Expose Gradio port EXPOSE 7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:7860/ || exit 1 # Environment variables for production ENV GRADIO_SERVER_NAME="0.0.0.0" ENV GRADIO_SERVER_PORT=7860 ENV TRANSFORMERS_CACHE="/app/.cache/huggingface" ENV HF_HOME="/app/.cache/huggingface" # Run the application CMD ["python3", "app.py"] # Labels for container metadata LABEL org.opencontainers.image.title="AI Agency Pro" LABEL org.opencontainers.image.description="Multi-Agent AI System with GPU Inference" LABEL org.opencontainers.image.version="1.0.0" LABEL org.opencontainers.image.source="https://huggingface.co/spaces/dlynch90/AI-Agency-Pro"