Spaces:
Running
Running
Upload Dockerfile
Browse files- Dockerfile +8 -10
Dockerfile
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
-
# Use a slim Python image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
# FIX: Replaced 'libgl1-mesa-glx' with 'libgl1'
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
build-essential \
|
| 8 |
libgl1 \
|
|
@@ -10,23 +8,23 @@ RUN apt-get update && apt-get install -y \
|
|
| 10 |
git \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
-
#
|
| 14 |
RUN useradd -m -u 1000 user
|
| 15 |
USER user
|
| 16 |
ENV HOME=/home/user \
|
| 17 |
PATH=/home/user/.local/bin:$PATH
|
| 18 |
-
|
| 19 |
WORKDIR $HOME/app
|
| 20 |
|
| 21 |
-
#
|
| 22 |
COPY --chown=user requirements.txt $HOME/app/requirements.txt
|
| 23 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 24 |
|
| 25 |
-
#
|
|
|
|
| 26 |
COPY --chown=user . $HOME/app
|
| 27 |
|
| 28 |
-
#
|
|
|
|
|
|
|
| 29 |
EXPOSE 7860
|
| 30 |
-
|
| 31 |
-
# Launch the app and bind to 0.0.0.0 so the HF proxy can find it
|
| 32 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# 1. System dependencies (Rarely change - cached first)
|
|
|
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
build-essential \
|
| 6 |
libgl1 \
|
|
|
|
| 8 |
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# 2. Setup user
|
| 12 |
RUN useradd -m -u 1000 user
|
| 13 |
USER user
|
| 14 |
ENV HOME=/home/user \
|
| 15 |
PATH=/home/user/.local/bin:$PATH
|
|
|
|
| 16 |
WORKDIR $HOME/app
|
| 17 |
|
| 18 |
+
# 3. Python Requirements (Only re-installs if requirements.txt changes)
|
| 19 |
COPY --chown=user requirements.txt $HOME/app/requirements.txt
|
| 20 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 21 |
|
| 22 |
+
# 4. App Code (Changes constantly - cached last)
|
| 23 |
+
# This ensures a 1-line change in app.py doesn't re-trigger pip install!
|
| 24 |
COPY --chown=user . $HOME/app
|
| 25 |
|
| 26 |
+
# 5. Launch
|
| 27 |
+
# GRADIO_SERVER_NAME ensures it binds to the HF internal network
|
| 28 |
+
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 29 |
EXPOSE 7860
|
|
|
|
|
|
|
| 30 |
CMD ["python", "app.py"]
|