| # Use a base image with Python | |
| FROM python:3.10-slim | |
| # Install git and other build tools | |
| # The specific command depends on the base image's package manager. | |
| # For Debian/Ubuntu-based images like python:3.10-slim, it's apt-get. | |
| RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | |
| RUN python3 -m pip install --upgrade pip | |
| # Set the working directory in the container | |
| ENV CUDA_HOME=/usr/local/cuda | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install torch==2.3.0 | |
| RUN pip install --no-cache-dir --upgrade setuptools wheel packaging | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of your application code | |
| COPY . . | |
| # Expose the port your application will run on | |
| EXPOSE 7860 | |
| # Command to run your application using Uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |