File size: 746 Bytes
d2505cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
db568be
 
 
9badaa4
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
27
28
29
30
# 1. Base image
FROM python:3.9

# 2. Install system deps for RealESRGAN & PIL
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      git build-essential \
      libsm6 libxext6 libxrender1 \
      libgl1-mesa-glx && \
    rm -rf /var/lib/apt/lists/*

# 3. Create non-root user (for pip cache ownership)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# 4. Workdir & Python deps
WORKDIR /app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
 && pip install --no-cache-dir -r requirements.txt

# 5. Copy app code
COPY --chown=user . .

# 6. Expose & run 
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]