Spaces:
Running
Running
FROM python:3.9-slim | |
# Set working directory | |
WORKDIR /app | |
# Create cache directory with proper permissions | |
RUN mkdir -p /app/.cache && chmod 755 /app/.cache | |
# Set environment variables for cache | |
ENV HF_HOME=/app/.cache | |
ENV TRANSFORMERS_CACHE=/app/.cache/transformers | |
ENV HF_HUB_CACHE=/app/.cache/hub | |
# Copy requirements first for better caching | |
COPY requirements.txt . | |
# Install dependencies | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Create cache directories with proper permissions | |
RUN mkdir -p $HF_HOME $TRANSFORMERS_CACHE $HF_HUB_CACHE && \ | |
chmod -R 755 /app/.cache | |
# Expose port | |
EXPOSE 7860 | |
# Run the application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |