FROM python:3.13-slim AS build
WORKDIR /build
COPY opspilot/cluster/requirements.lock .
RUN pip wheel --wheel-dir /wheelhouse -r requirements.lock
FROM registry.k8s.io/kubectl:v1.34.1 AS kubectl
FROM python:3.13-slim
COPY --from=kubectl /bin/kubectl /usr/local/bin/kubectl
COPY --from=build /wheelhouse /wheelhouse
COPY opspilot/cluster/requirements.lock /tmp/requirements.lock
RUN pip install --no-index --find-links=/wheelhouse -r /tmp/requirements.lock && rm -rf /wheelhouse
WORKDIR /app
COPY opspilot/cluster/*.py opspilot/cluster/incluster.json ./
RUN mkdir data && chown 65532:65532 data
USER 65532
CMD ["uvicorn","api:app","--host","0.0.0.0","--port","8080","--workers","1"]
