FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 # Install system dependencies RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ libgl1 \ libglib2.0-0 \ curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install Python dependencies (with pip cache for faster rebuilds) COPY requirements.txt . RUN --mount=type=cache,target=/root/.cache/pip \ pip3 install -r requirements.txt # Copy application code COPY app.py . EXPOSE 5001 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:5001/health || exit 1 CMD ["python3", "app.py"]