@@ -21,13 +21,21 @@ COPY internal/ internal/
2121# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
2222RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
2323
24- # Install curl
25- RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
24+ # Install Git
25+ RUN apt-get update && apt-get install -y git
2626
27- # Install kubectl for must-gather and helm upgrades hooks
28- RUN if [ "$TARGETARCH" = "x86_64" ]; then OS_ARCH="amd64" ; elif [ "$TARGETARCH" = "aarch64" ]; then OS_ARCH="arm64" ; else OS_ARCH="$TARGETARCH" ; fi \
29- && curl -LO https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/${OS_ARCH}/kubectl \
30- && chmod +x ./kubectl
27+ WORKDIR /utils
28+
29+ # Clone the k8s-operator-libs repo
30+ RUN git clone https://github.com/NVIDIA/k8s-operator-libs.git
31+
32+ WORKDIR /utils/k8s-operator-libs
33+
34+ # Checkout the version of the k8s-operator-libs repo that is compatible with the current version of the NIM Operator
35+ RUN git checkout 7d667fbaa7ac8fb02196987eb65296856e2dd564
36+
37+ # Build the crd-apply-tool
38+ RUN go build -o crd-apply-tool cmd/apply-crds/main.go
3139
3240# Use distroless as minimal base image to package the manager binary
3341FROM nvcr.io/nvidia/distroless/go:v3.1.5
@@ -36,7 +44,7 @@ ARG VERSION="unknown"
3644
3745WORKDIR /
3846COPY --from=builder /workspace/manager .
39- COPY --from=builder /workspace/kubectl /usr/local/bin/kubectl
47+ COPY --from=builder /utils/k8s-operator-libs/crd-apply-tool /usr/local/bin/crd-apply-tool
4048
4149# Add CRD resource into the image for helm upgrades
4250COPY deployments/helm/k8s-nim-operator/crds/ /opt/nim-operator/crds/
0 commit comments