# Base image FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime # Install system dependencies RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ llibxrender1 \ libxext6 \ python3-venv \ && rm -rf /var/lib/apt/lists/* # Set the working directory WORKDIR /app # Create a virtual environment RUN python3 -m venv /app/venv # Activate the virtual environment and install Python dependencies RUN /app/venv/bin/pip install --upgrade pip \ && /app/venv/bin/pip install --no-cache-dir -r /app/requirements.txt # Ensure the virtual environment's Python and Pip are used by default ENV PATH="/app/venv/bin:$PATH" # Copy the project files COPY . /app # Expose the port (matching your app configuration) EXPOSE 7860 # Start the FastAPI server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]