droboticflow/Dockerfile.ops-runner
eust-w 0802ff7c23 🐛 Take kubectl for the ops runner from an image instead of dl.k8s.io
The POC Kaniko build network cannot reach dl.k8s.io (TLS reset), so the
first ops-runner build failed. Copy /bin/kubectl from rancher/kubectl,
which the build pulls through the existing Docker Hub mirror.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 14:54:17 +08:00

54 lines
2.2 KiB
Docker

ARG DROBOTICFLOW_BUILD_COMMIT=unknown
ARG DROBOTICFLOW_BUILD_TIME=unknown
ARG DROBOTICFLOW_SOURCE_BRANCH=unknown
ARG KUBECTL_IMAGE=rancher/kubectl:v1.31.4
# The ops runner executes catalog script actions for the product's ops assistant (see ops/README.md).
# It holds droctl plus the scripts and repository data those actions read; it never holds credentials,
# which come from its ServiceAccount and the namespace's existing secrets at run time.
# kubectl comes from an image rather than dl.k8s.io, which the POC build network cannot reach.
FROM ${KUBECTL_IMAGE} AS kubectl
FROM golang:1.24-bookworm AS go-build
WORKDIR /src
ARG GOPROXY=https://proxy.golang.org,direct
COPY go.mod go.sum ./
RUN GOPROXY="${GOPROXY}" go mod download
COPY cmd ./cmd
COPY internal ./internal
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/droctl ./cmd/droctl
FROM node:22-bookworm-slim AS runtime
ARG DROBOTICFLOW_BUILD_COMMIT
ARG DROBOTICFLOW_BUILD_TIME
ARG DROBOTICFLOW_SOURCE_BRANCH
WORKDIR /opt/droboticflow
ENV DROCTL_ROOT=/opt/droboticflow
ENV DROBOTICFLOW_SOURCE_BRANCH=${DROBOTICFLOW_SOURCE_BRANCH}
ENV DROBOTICFLOW_IMAGE_BUILD_COMMIT=${DROBOTICFLOW_BUILD_COMMIT}
ENV DROBOTICFLOW_IMAGE_BUILD_TIME=${DROBOTICFLOW_BUILD_TIME}
ENV HOME=/tmp
LABEL org.opencontainers.image.revision=${DROBOTICFLOW_BUILD_COMMIT}
LABEL org.opencontainers.image.created=${DROBOTICFLOW_BUILD_TIME}
RUN apt-get update \
&& apt-get install -y --no-install-recommends bash ca-certificates python3 \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd --system --gid 10001 droboticflow && useradd --system --uid 10001 --gid droboticflow --home-dir /tmp --shell /usr/sbin/nologin droboticflow
COPY --from=kubectl /bin/kubectl /usr/local/bin/kubectl
COPY --from=go-build /out/droctl /usr/local/bin/droctl
COPY --chown=10001:10001 ops ./ops
COPY --chown=10001:10001 scripts ./scripts
COPY --chown=10001:10001 k8s ./k8s
COPY --chown=10001:10001 internal/api/builtin_operators_catalog.json ./internal/api/builtin_operators_catalog.json
COPY --chown=10001:10001 backend ./backend
COPY --chown=10001:10001 operator-repos ./operator-repos
COPY --chown=10001:10001 package.json ./package.json
USER 10001:10001
ENTRYPOINT []
CMD ["droctl", "list", "--surface", "product"]