FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Set environment variables for Hugging Face cache & config (for writable directories) ENV HOME=/app ENV XDG_CONFIG_HOME=/app/.config ENV XDG_CACHE_HOME=/app/.cache RUN mkdir -p /app/.config /app/.cache/huggingface && chmod -R 777 /app/.cache # Copy requirements first for layer caching and install dependencies COPY requirements.txt ./ RUN pip install --upgrade pip && \ pip install --upgrade ibm-watsonx-orchestrate && \ pip install --no-cache-dir -r requirements.txt # Copy the rest of your source code COPY . . EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]