# Use a multi-stage build for a smaller image FROM python:3.13-slim # Install system dependencies (Node.js is needed for Claude Code CLI) RUN apt-get update && apt-get install -y \ curl \ git \ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && rm -rf /var/lib/apt/lists/* # Install Claude Code CLI globally RUN npm install -g @anthropic-ai/claude-code # Set working directory WORKDIR /app # Copy dependency files COPY requirements.txt ./ # Install dependencies using pip RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Create a non-root user for Hugging Face (UID 1000 is standard) RUN useradd -m -u 1000 user && \ chown -R user:user /app USER user ENV HOME=/home/user ENV PATH=/home/user/.local/bin:$PATH # Expose the port Hugging Face expects EXPOSE 7860 # Set environment variables ENV HOST=0.0.0.0 ENV PORT=7860 ENV PYTHONUNBUFFERED=1 # Run the server CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]