drrobot9's picture
push updated backend changes and auto start buiding
6584be3 verified
raw
history blame contribute delete
956 Bytes
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Set Hugging Face cache to a writable directory in /tmp
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface
ENV HF_HUB_CACHE=/tmp/huggingface
# Create cache directory with proper permissions
RUN mkdir -p /tmp/huggingface && chmod 777 /tmp/huggingface
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Copy project files
COPY . /app
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Run FastAPI with Uvicorn (with reload disabled for production)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]