# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.10-bookworm-slim AS uv

# Set working directory
WORKDIR /app

# Enable bytecode compilation
ENV UV_COMPILE_BYTECODE=1

# Copy necessary files
COPY pyproject.toml uv.lock /app/

# Install the project's dependencies using the lockfile and settings
RUN --mount=type=cache,target=/root/.cache/uv     uv sync --frozen --no-install-project --no-dev --no-editable

# Add the rest of the project source code
ADD src /app/src

# Install the project
RUN --mount=type=cache,target=/root/.cache/uv     uv sync --frozen --no-dev --no-editable

# Final stage with a slim python image
FROM python:3.10-slim-bookworm

# Set working directory
WORKDIR /app

# Copy installed environment and project files
COPY --from=uv /root/.local /root/.local
COPY --from=uv /app /app

# Set PATH to include virtual environment binaries
ENV PATH="/root/.local/bin:/app/.venv/bin:$PATH"

# Entrypoint to start the MCP server
ENTRYPOINT ["mcp-perplexity"]
