Spaces:
Running
Running
File size: 798 Bytes
afd56bc | 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 28 29 30 31 | FROM python:3.11.9-slim
# Install necessary system packages
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Upgrade pip
RUN pip install --upgrade pip
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Create cache directory for Hugging Face Transformers
ENV TRANSFORMERS_CACHE=/tmp/huggingface_cache
RUN mkdir -p /tmp/huggingface_cache && chmod 777 /tmp/huggingface_cache
# Copy application code
COPY . .
# Set permissions for Hugging Face Space (requires non-root user or open permissions for /app/data if any)
RUN chmod -R 777 /app
# Run migrations and start FastAPI server
CMD uvicorn server:app --host 0.0.0.0 --port 7860
|