File size: 847 Bytes
4a15a33
 
 
 
 
 
 
 
 
 
 
 
 
 
7ad47ac
 
4a15a33
 
 
 
 
 
 
 
7ad47ac
4a15a33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Use a standard base image with CUDA support
FROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime

# Set environment variables for caching
ENV DEBIAN_FRONTEND=noninteractive
ENV HF_HOME="/data/huggingface"
ENV UV_CACHE_DIR="/data/uv_cache"

# Install git and uv (for faster package installation)
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
RUN pip install uv

# Copy requirements and install them efficiently
COPY requirements.txt .
# THE FIX IS HERE: Add the --system flag to the uv command
RUN uv pip install --no-cache --system -r requirements.txt

# Copy the application code into the container
COPY ./app.py /app/app.py
WORKDIR /app

# Expose the port the app will run on
EXPOSE 7860

# The command to run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]