# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Updated base image approach
FROM python:3.10-bookworm AS builder
WORKDIR /app
# Install UV and create virtual environment
RUN pip install uv==0.2.5 && \
uv venv -n .venv
# Copy all necessary files first
COPY pyproject.toml README.md ./
COPY src ./src
# Generate lock file and install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
. .venv/bin/activate && \
uv pip compile pyproject.toml -o uv.lock && \
uv pip install --no-deps -r uv.lock && \
uv pip install --no-deps .
# Final stage
FROM python:3.10-slim-bookworm
WORKDIR /app
# Copy virtual environment and source code from builder
COPY --from=builder /app/.venv ./.venv
COPY --from=builder /app/src ./src
# Ensure scripts from .venv/bin are in PATH
ENV PATH="/app/.venv/bin:$PATH"
# Run as non-root user
RUN useradd -m appuser && chown -R appuser /app
USER appuser
ENTRYPOINT ["mcp-perplexity"]