AndrewRqy commited on
Commit ·
b32b87d
1
Parent(s): 128a3ce
Switch to Docker SDK on HF Space — full control over launch, no auto-launcher
Browse files- Dockerfile +34 -0
- README.md +2 -4
Dockerfile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
+
|
| 3 |
+
# System deps for Pillow (libjpeg, zlib) + curl for healthcheck.
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
libjpeg-dev \
|
| 6 |
+
zlib1g-dev \
|
| 7 |
+
curl \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# HF Spaces require a non-root user with $HOME=/home/user.
|
| 11 |
+
RUN useradd -m -u 1000 user
|
| 12 |
+
USER user
|
| 13 |
+
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
| 14 |
+
WORKDIR $HOME/app
|
| 15 |
+
|
| 16 |
+
# Install Python deps first so they cache across code changes.
|
| 17 |
+
COPY --chown=user requirements.txt requirements.txt
|
| 18 |
+
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 19 |
+
|
| 20 |
+
# Copy the rest of the app.
|
| 21 |
+
COPY --chown=user . .
|
| 22 |
+
|
| 23 |
+
# HF Spaces routes external traffic to port 7860 inside the container.
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Bind to 0.0.0.0 so HF's proxy can reach us. Disable Gradio's analytics
|
| 27 |
+
# (it tries to phone home and slows boot). ORACLES_FORCE_MOCK is left
|
| 28 |
+
# unset so the app uses the real Modal LLM when the secrets are present.
|
| 29 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0 \
|
| 30 |
+
GRADIO_SERVER_PORT=7860 \
|
| 31 |
+
GRADIO_ANALYTICS_ENABLED=False \
|
| 32 |
+
PYTHONUNBUFFERED=1
|
| 33 |
+
|
| 34 |
+
CMD ["python", "app.py"]
|
README.md
CHANGED
|
@@ -3,11 +3,9 @@ title: The Apprentice
|
|
| 3 |
emoji: 🌲
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: yellow
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
python_version: "3.10"
|
| 9 |
suggested_hardware: cpu-basic
|
| 10 |
-
app_file: app.py
|
| 11 |
pinned: false
|
| 12 |
license: mit
|
| 13 |
short_description: Five oracles, five trials — branching pixel-art game.
|
|
|
|
| 3 |
emoji: 🌲
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: yellow
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
|
|
|
| 8 |
suggested_hardware: cpu-basic
|
|
|
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
short_description: Five oracles, five trials — branching pixel-art game.
|