Spaces:
Runtime error
Runtime error
File size: 876 Bytes
5d06482 193c96c 5d06482 193c96c 7cc3063 3a96d07 246e290 08ef9f1 193c96c 08ef9f1 193c96c 08ef9f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /code
# Set environment variables - ALL EPHEMERAL CACHING (no persistent storage)
# All caches in fast /tmp/ storage (cleared on restart - prevents future bloat)
ENV TRANSFORMERS_CACHE="/tmp/transformers_cache"
ENV HF_HOME="/tmp/hf_cache"
ENV MPLCONFIGDIR="/tmp/matplotlib_cache"
ENV TORCH_HOME="/tmp/torch_cache"
ENV PYTORCH_KERNEL_CACHE_PATH="/tmp/torch_kernels"
# PyTorch CUDA memory allocation optimization
ENV PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
# Copy and install dependencies FIRST (for better caching)
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --trusted-host pypi.python.org -r requirements.txt
# Copy application code LAST
COPY . .
CMD ["python", "app.py"]
|