FROM python:3.11-slim

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

# Copy the entire project into the container
COPY . /app

# Set working directory
WORKDIR /app

# Install application dependencies using uv
# Install dependencies — works even if uv.lock doesn't exist
RUN if [ -f uv.lock ]; then uv sync --frozen --no-cache; else uv sync --no-cache; fi

# Run FastAPI using system Python
# Run main.py directly
# uv run uvicorn main:app --reload --port 9001
CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "9001"]
