# ---- Base image ---- FROM python:3.11-slim # ---- Working directory ---- WORKDIR /app # ---- Set environment variables ---- ENV TRANSFORMERS_CACHE=/app/.cache/huggingface ENV HF_HOME=/app/.cache/huggingface ENV PYTHONUNBUFFERED=1 # ---- Install system dependencies ---- RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* # ---- Copy requirements and install dependencies ---- COPY requirements.txt . RUN pip install --upgrade pip setuptools wheel && \ pip install --no-cache-dir -r requirements.txt # ---- Copy application code ---- COPY . . # ---- Create directories with proper permissions ---- RUN mkdir -p /app/.files /app/.cache/huggingface /app/.chainlit && \ chmod -R 777 /app # ---- Expose port ---- EXPOSE 7860 # ---- Run application ---- CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860", "--headless"]