Update Dockerfile
Browse files- Dockerfile +17 -5
Dockerfile
CHANGED
@@ -10,10 +10,14 @@ ENV DEBIAN_FRONTEND=noninteractive \
|
|
10 |
PYTHONPATH=/app \
|
11 |
GRADIO_SERVER_NAME=0.0.0.0 \
|
12 |
GRADIO_SERVER_PORT=7860 \
|
13 |
-
HF_HOME=/
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# Install system dependencies in single layer
|
19 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
@@ -60,7 +64,6 @@ RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https:/
|
|
60 |
&& find /usr/local -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
|
61 |
|
62 |
# Ensure Hugging Face cache directories are writable
|
63 |
-
RUN mkdir -p /tmp/huggingface /tmp/transformers && chmod -R a+w /tmp/huggingface /tmp/transformers
|
64 |
|
65 |
# Create models directory and download models efficiently
|
66 |
RUN mkdir -p models && cd models \
|
@@ -86,6 +89,15 @@ RUN chmod -R a+w /app
|
|
86 |
RUN mkdir -p output tmp
|
87 |
# Ensure output and tmp directories are writable (fix PermissionError for session_id.txt)
|
88 |
RUN chmod -R a+w /app/output /app/tmp || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
# Add HF Spaces specific metadata
|
90 |
LABEL space.title="Text 2 Mnaim" \
|
91 |
space.sdk="docker" \
|
|
|
10 |
PYTHONPATH=/app \
|
11 |
GRADIO_SERVER_NAME=0.0.0.0 \
|
12 |
GRADIO_SERVER_PORT=7860 \
|
13 |
+
HF_HOME=/app/.cache/huggingface \
|
14 |
+
HF_HUB_CACHE=/app/.cache/huggingface/hub \
|
15 |
+
TRANSFORMERS_CACHE=/app/.cache/transformers \
|
16 |
+
SENTENCE_TRANSFORMERS_HOME=/app/.cache/sentence_transformers \
|
17 |
+
PATH="/root/.TinyTeX/bin/x86_64-linux:$PATH" \
|
18 |
+
GRADIO_ALLOW_FLAGGING=never \
|
19 |
+
GRADIO_ANALYTICS_ENABLED=False \
|
20 |
+
HF_HUB_DISABLE_TELEMETRY=1
|
21 |
|
22 |
# Install system dependencies in single layer
|
23 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
64 |
&& find /usr/local -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
|
65 |
|
66 |
# Ensure Hugging Face cache directories are writable
|
|
|
67 |
|
68 |
# Create models directory and download models efficiently
|
69 |
RUN mkdir -p models && cd models \
|
|
|
89 |
RUN mkdir -p output tmp
|
90 |
# Ensure output and tmp directories are writable (fix PermissionError for session_id.txt)
|
91 |
RUN chmod -R a+w /app/output /app/tmp || true
|
92 |
+
|
93 |
+
RUN mkdir -p output tmp logs \
|
94 |
+
&& mkdir -p /app/.cache/huggingface/hub \
|
95 |
+
&& mkdir -p /app/.cache/transformers \
|
96 |
+
&& mkdir -p /app/.cache/sentence_transformers \
|
97 |
+
&& chmod -R 755 /app/.cache \
|
98 |
+
&& chmod 755 /app/models \
|
99 |
+
&& ls -la /app/models/ \
|
100 |
+
&& echo "Cache directories created with proper permissions"
|
101 |
# Add HF Spaces specific metadata
|
102 |
LABEL space.title="Text 2 Mnaim" \
|
103 |
space.sdk="docker" \
|