FROM python:3.12-slim

WORKDIR /app

# Install system deps
RUN apt-get update -qq && \
    apt-get install -y -qq --no-install-recommends git curl openssh-client && \
    rm -rf /var/lib/apt/lists/*

# Install uv for fast dependency management
RUN pip install --no-cache-dir uv

# Copy project files
COPY pyproject.toml .
COPY dobby/ dobby/

# Install the package
RUN uv pip install --system -e .

# Create data directories
RUN mkdir -p /data/results

# Default config
ENV DOBBY_HOST=0.0.0.0
ENV DOBBY_PORT=8420

EXPOSE 8420

VOLUME ["/data"]

# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
    CMD curl -sf http://localhost:8420/health || exit 1

ENTRYPOINT ["dobby"]
CMD ["start", "--config", "/data/dobby.yaml"]
