# Confucius Code Agent - Docker Image
# Based on arXiv:2512.10398

FROM python:3.11-slim

# Set workdir
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install Poetry
RUN pip install --no-cache-dir poetry==1.7.1

# Copy project files
COPY pyproject.toml poetry.lock* ./

# Configure Poetry: don't create virtualenv in container
RUN poetry config virtualenvs.create false

# Install dependencies
RUN poetry install --no-interaction --no-ansi --no-root

# Copy source code
COPY . .

# Install the package
RUN poetry install --no-interaction --no-ansi

# Expose Gradio port
EXPOSE 7862

# Environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# Default command: run WebUI
CMD ["python", "webui.py"]
