File size: 803 Bytes
2027bf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 1. Use a modern Python slim image
FROM python:3.10-slim

# 2. Set the working directory
WORKDIR /code

# 3. Install the NEW OpenGL dependencies (Fixes the "no installation candidate" error)
RUN apt-get update && apt-get install -y \

    libgl1 \
    libglx-mesa0 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# 4. Copy requirements and install (No cache saves space)
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# 5. Copy the rest of your application files
COPY . .

# 6. Set permissions for the MiDaS/Torch cache
RUN mkdir -p /.cache && chmod 777 /.cache
ENV TORCH_HOME=/.cache

# 7. Start the server on the HF-required port
CMD ["uvicorn", "main.py:app", "--host", "0.0.0.0", "--port", "7860"]