Commit
·
a3114c9
1
Parent(s):
412be30
Pre-download embedding model during build to fix permissions
Browse files- Dockerfile +7 -4
Dockerfile
CHANGED
|
@@ -11,14 +11,17 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 11 |
# Step 4: Copy the rest of your application's code
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
-
# Step 5: Expose the port Gradio will run on
|
| 15 |
-
EXPOSE 7860
|
| 16 |
-
|
| 17 |
# Set a writable cache directory for Hugging Face models
|
| 18 |
-
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 19 |
ENV HUGGING_FACE_HUB_CACHE="/app/cache"
|
| 20 |
ENV SENTENCE_TRANSFORMERS_HOME="/app/cache"
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
ENV PYTHONUNBUFFERED 1
|
| 23 |
|
| 24 |
# Step 6: Define the command to run your app
|
|
|
|
| 11 |
# Step 4: Copy the rest of your application's code
|
| 12 |
COPY . .
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
# Set a writable cache directory for Hugging Face models
|
|
|
|
| 15 |
ENV HUGGING_FACE_HUB_CACHE="/app/cache"
|
| 16 |
ENV SENTENCE_TRANSFORMERS_HOME="/app/cache"
|
| 17 |
|
| 18 |
+
# --- THIS IS THE NEW, CRUCIAL LINE ---
|
| 19 |
+
# Pre-download the model during the build process (as root)
|
| 20 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
| 21 |
+
|
| 22 |
+
# Step 5: Expose the port Gradio will run on
|
| 23 |
+
EXPOSE 7860
|
| 24 |
+
|
| 25 |
ENV PYTHONUNBUFFERED 1
|
| 26 |
|
| 27 |
# Step 6: Define the command to run your app
|