# Multi-stage build for benchmind.
# Stage 1: build wheel.
FROM python:3.13-slim AS builder

WORKDIR /build
RUN pip install --no-cache-dir build
COPY pyproject.toml README.md LICENSE ./
COPY src ./src
RUN python -m build --wheel

# Stage 2: runtime image with k6.
FROM grafana/k6:latest

USER root
RUN apk add --no-cache python3 py3-pip

WORKDIR /app
COPY --from=builder /build/dist/*.whl /tmp/
RUN pip install --break-system-packages --no-cache-dir /tmp/*.whl && rm /tmp/*.whl

# Create a non-root user for running tests.
RUN adduser -D -u 1000 benchmind
USER benchmind

ENTRYPOINT ["benchmind"]
CMD ["--help"]
