Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +12 -0
Dockerfile
CHANGED
|
@@ -4,10 +4,22 @@ FROM python:3.9-slim
|
|
| 4 |
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Copy requirements.txt and install dependencies
|
| 8 |
COPY requirements.txt .
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Copy the entire app into the container
|
| 12 |
COPY . .
|
| 13 |
|
|
|
|
| 4 |
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Create a writable cache directory
|
| 8 |
+
RUN mkdir -p /app/cache
|
| 9 |
+
|
| 10 |
+
# Set environment variables for Hugging Face cache
|
| 11 |
+
ENV HF_HOME="/app/cache"
|
| 12 |
+
ENV TRANSFORMERS_CACHE="/app/cache"
|
| 13 |
+
ENV SENTENCE_TRANSFORMERS_HOME="/app/cache"
|
| 14 |
+
|
| 15 |
# Copy requirements.txt and install dependencies
|
| 16 |
COPY requirements.txt .
|
| 17 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
+
# Force model download during build (ensures model is available inside container)
|
| 20 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2', cache_folder='/app/cache')"
|
| 21 |
+
RUN python -c "from transformers import AutoModelForSeq2SeqLM; AutoModelForSeq2SeqLM.from_pretrained('google/long-t5-tglobal-base', cache_dir='/app/cache')"
|
| 22 |
+
|
| 23 |
# Copy the entire app into the container
|
| 24 |
COPY . .
|
| 25 |
|