File size: 849 Bytes
581c537
 
64ac21d
581c537
 
fef26fe
 
581c537
 
 
64ac21d
581c537
 
 
 
 
 
64ac21d
581c537
 
 
64ac21d
 
581c537
 
64ac21d
 
 
581c537
 
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
FROM python:3.10-slim

# 1. System dependencies (Rarely change - cached first)
RUN apt-get update && apt-get install -y \
    build-essential \
    libgl1 \
    libglu1-mesa \
    git \
    && rm -rf /var/lib/apt/lists/*

# 2. Setup user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app

# 3. Python Requirements (Only re-installs if requirements.txt changes)
COPY --chown=user requirements.txt $HOME/app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# 4. App Code (Changes constantly - cached last)
# This ensures a 1-line change in app.py doesn't re-trigger pip install!
COPY --chown=user . $HOME/app

# 5. Launch
# GRADIO_SERVER_NAME ensures it binds to the HF internal network
ENV GRADIO_SERVER_NAME="0.0.0.0"
EXPOSE 7860
CMD ["python", "app.py"]