FROM python:3.12-slim

WORKDIR /app

# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

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

# Copy dependency specification first for better layer caching
COPY pyproject.toml ./

# Install the package and its dependencies
RUN uv pip install --system .

# Copy the rest of the application
COPY . .

# Reinstall in development mode to include the source code
RUN uv pip install --system -e .

# Create output directory
RUN mkdir -p /app/output

# Set the working directory for user output
WORKDIR /app/output

# Run the wizard
ENTRYPOINT ["protocol-wizard"]
