updated Dockerfile with caches moved off the 50G root volume and onto /data
Browse files1 . New cache directories created on /data (Prevents hitting the 50 GB root limit)
2. Cache-cleaning step (Deletes any leftover Hugging Face caches during image build)
3.Updated environment variables (Moved from /tmp → /data so model/dataset downloads don’t fill root)
- Dockerfile +20 -8
Dockerfile
CHANGED
|
@@ -11,14 +11,26 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
libomp-dev \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# Create
|
| 15 |
-
RUN mkdir -p
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Copy requirements file
|
| 24 |
COPY requirements.txt /app/requirements.txt
|
|
|
|
| 11 |
libomp-dev \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Create cache directories on /data and matplotlib config dir
|
| 15 |
+
RUN mkdir -p \
|
| 16 |
+
/data/.huggingface \
|
| 17 |
+
/data/.cache/huggingface/datasets \
|
| 18 |
+
/data/.cache/huggingface/transformers \
|
| 19 |
+
/tmp/matplotlib \
|
| 20 |
+
&& chmod -R 777 /data /tmp/matplotlib
|
| 21 |
+
|
| 22 |
+
# Clean any old Hugging Face caches (defensive)
|
| 23 |
+
RUN rm -rf \
|
| 24 |
+
/root/.cache/huggingface \
|
| 25 |
+
/root/.cache/huggingface_hub \
|
| 26 |
+
/root/.cache/huggingface/datasets || true
|
| 27 |
+
|
| 28 |
+
# Set cache environment variables to point at /data
|
| 29 |
+
ENV HF_HOME=/data/.huggingface
|
| 30 |
+
ENV HF_HUB_CACHE=/data/.cache/huggingface/hub
|
| 31 |
+
ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
|
| 32 |
+
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
|
| 33 |
+
ENV MPLCONFIGDIR=/tmp/matplotlib
|
| 34 |
|
| 35 |
# Copy requirements file
|
| 36 |
COPY requirements.txt /app/requirements.txt
|