FROM python:3.12-slim

# Install uv for faster package management
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

WORKDIR /app

# Copy the snipeit-python-api dependency first
COPY snipeit-python-api /app/snipeit-python-api/

# Copy the main project
COPY snipeit-mcp /app/

# Update pyproject.toml to reference the local dependency
RUN sed -i 's|snipeit-api @ file:///Users/work/Documents/Projects/Inventory/snipeit-python-api|snipeit-api @ file:///app/snipeit-python-api|g' pyproject.toml

# Install the project with uv
RUN uv venv && uv pip install --no-cache -e .

# Set up environment
ENV PYTHONUNBUFFERED=1
ENV PATH=/app/.venv/bin:$PATH

ENTRYPOINT ["python", "-m", "snipeit_mcp"]
