FROM python:3.12-slim

RUN apt-get update && apt-get -y dist-upgrade && rm -rf /var/lib/apt/lists/*

# Install git (needed for git operations in agentic Claude)
RUN apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY . .

# Expose port (Railway will set $PORT)
EXPOSE 8000

# Run the application (Railway provides PORT)
CMD ["python", "main.py"]