# Use official Python slim image for smaller size | |
FROM python:3.11-slim | |
# Set environment variables for Python | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
ENV TRANSFORMERS_CACHE=/tmp/.cache | |
# Set work directory | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install Python dependencies | |
COPY requirements.txt . | |
# Uninstall any old/conflicting supabase dependencies | |
RUN pip uninstall -y supabase postgrest-py gotrue || true | |
# Force rebuild for clean supabase install | |
RUN pip install --upgrade pip | |
RUN pip install -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Expose port for FastAPI | |
EXPOSE 7860 | |
# Command to run the app with Uvicorn | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |