FROM golang:1.23-alpine AS builder WORKDIR /app COPY . . # Build the main operator binary RUN go build -o operator cmd/operator/main.go # Download OpenShift CLI in the builder stage RUN apk add --no-cache curl tar && \ curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz && \ tar -xzf openshift-client-linux.tar.gz && \ mv oc /usr/local/bin/ && \ chmod +x /usr/local/bin/oc && \ rm -f openshift-client-linux.tar.gz kubectl FROM alpine:latest WORKDIR /app # Install necessary runtime dependencies RUN apk add --no-cache ca-certificates libc6-compat # Copy the operator binary from the builder stage COPY --from=builder /app/operator . # Copy the OpenShift CLI from the builder stage COPY --from=builder /usr/local/bin/oc /usr/local/bin/ # Make sure the OpenShift CLI is executable RUN chmod +x /usr/local/bin/oc CMD ["./operator"]