# syntax=docker/dockerfile:1 FROM python:3.11-slim # Create user with UID 1000 (Required by Hugging Face Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Install system dependencies (switch to root temporarily) USER root RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ && rm -rf /var/lib/apt/lists/* USER user # Install Python dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir litellm # Copy application code and scripts COPY --chown=user app/ ./app/ COPY --chown=user start-hf.sh . # Ensure script is executable RUN chmod +x start-hf.sh ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 # Expose port 7860 for Hugging Face Spaces health checks EXPOSE 7860 # Run the startup script (Dummy web server + Celery worker) CMD ["bash", "start-hf.sh"]