text-to-3d-backend / Dockerfile
aniket47's picture
Fix build error: Remove build-time model preloading and optimize for HF Spaces
091271a
raw
history blame
755 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set environment variables for HuggingFace caching (runtime download)
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
ENV HF_DATASETS_CACHE=/tmp/huggingface_datasets
ENV TORCH_HOME=/tmp/torch
# Note: Models will be downloaded at runtime for better compatibility with Hugging Face Spaces
# This avoids build-time resource constraints and allows for proper authentication
EXPOSE 7860
CMD ["python", "app.py"]