Spaces:
Sleeping
Sleeping
fix: Dockerfile (resolve RUNTIME_ERROR / gradio launch)
Browse files- Dockerfile +15 -1
Dockerfile
CHANGED
|
@@ -6,6 +6,10 @@ ENV DEBIAN_FRONTEND=noninteractive \
|
|
| 6 |
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 \
|
| 7 |
GRADLE_USER_HOME=/tmp/.gradle \
|
| 8 |
HF_HOME=/tmp/hf_cache \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
PATH=/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/java-21-openjdk-amd64/bin:/opt/gradle-8.7/bin:$PATH
|
| 10 |
|
| 11 |
# Base tooling
|
|
@@ -43,7 +47,17 @@ COPY --chown=user:user requirements.txt .
|
|
| 43 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 44 |
pip install --no-cache-dir -r requirements.txt
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
COPY --chown=user:user . .
|
| 47 |
|
| 48 |
EXPOSE 7860
|
| 49 |
-
|
|
|
|
|
|
|
|
|
| 6 |
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 \
|
| 7 |
GRADLE_USER_HOME=/tmp/.gradle \
|
| 8 |
HF_HOME=/tmp/hf_cache \
|
| 9 |
+
HF_HUB_CACHE=/tmp/hf_cache \
|
| 10 |
+
PORT=7860 \
|
| 11 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 12 |
+
GRADIO_SERVER_PORT=7860 \
|
| 13 |
PATH=/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/java-21-openjdk-amd64/bin:/opt/gradle-8.7/bin:$PATH
|
| 14 |
|
| 15 |
# Base tooling
|
|
|
|
| 47 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 48 |
pip install --no-cache-dir -r requirements.txt
|
| 49 |
|
| 50 |
+
# Pre-download the GGUF model at build time so the first user request does not
|
| 51 |
+
# have to wait for (and risk timing out on) a ~1GB download at runtime. This is
|
| 52 |
+
# the main reason the Space booted into RUNTIME_ERROR before the UI loaded.
|
| 53 |
+
RUN python -c "from huggingface_hub import hf_hub_download; \
|
| 54 |
+
hf_hub_download(repo_id='Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF', \
|
| 55 |
+
filename='qwen2.5-coder-1.5b-instruct-q4_k_m.gguf')" || \
|
| 56 |
+
echo 'model pre-download skipped (will download at runtime)'
|
| 57 |
+
|
| 58 |
COPY --chown=user:user . .
|
| 59 |
|
| 60 |
EXPOSE 7860
|
| 61 |
+
|
| 62 |
+
# Use exec form so signals propagate; app.py reads $PORT.
|
| 63 |
+
CMD ["python", "app.py"]
|