Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG GOLANG_BASE_IMG=golang:1.25.8
ARG OPERATOR_CONTROLLER_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:9.7

# Build the manager binary
FROM ${GOLANG_BASE_IMG} AS builder
FROM --platform=$BUILDPLATFORM ${GOLANG_BASE_IMG} AS builder

USER root

Expand Down Expand Up @@ -36,11 +36,13 @@ RUN cd helm-charts-k8s/charts && \
tar -xvzf node-feature-discovery-chart-0.18.3.tgz

ARG TARGET
ARG TARGETARCH
ARG TARGETOS

# Build
RUN git config --global --add safe.directory ${PWD} && make ${TARGET}
RUN git config --global --add safe.directory ${PWD} && GOOS=${TARGETOS} GOARCH=${TARGETARCH} make ${TARGET}

RUN curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl && \
RUN curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${TARGETARCH}/kubectl && \
chmod +x ./kubectl

FROM ${OPERATOR_CONTROLLER_BASE_IMAGE}
Expand Down
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,15 @@ docs-lint: ## Run docs Markdown lint + spelling (full ROCm-style docs lint).
manager: $(shell find -name "*.go") go.mod go.sum ## Build manager binary.
go build -ldflags="-X main.Version=$(PROJECT_VERSION) -X main.GitCommit=$(GIT_COMMIT) -X main.BuildTag=$(HOURLY_TAG_LABEL)" -o $@ ./cmd

# Platforms for multi-arch builds
PLATFORMS ?= linux/amd64,linux/ppc64le

.PHONY: docker-build
docker-build: ## Build docker image with the manager.
docker-build: ## Build and push multi-arch docker image with the manager.
docker buildx build --platform $(PLATFORMS) -t $(IMG) --label HOURLY_TAG=$(HOURLY_TAG_LABEL) --build-arg TARGET=manager --build-arg GOLANG_BASE_IMG=$(GOLANG_BASE_IMG) --build-arg OPERATOR_CONTROLLER_BASE_IMAGE=$(OPERATOR_CONTROLLER_BASE_IMAGE) --push .

.PHONY: docker-build-local
docker-build-local: ## Build docker image locally for current architecture only (no push).
DOCKER_BUILDKIT=1 docker build -t $(IMG) --label HOURLY_TAG=$(HOURLY_TAG_LABEL) --build-arg TARGET=manager --build-arg GOLANG_BASE_IMG=$(GOLANG_BASE_IMG) --build-arg OPERATOR_CONTROLLER_BASE_IMAGE=$(OPERATOR_CONTROLLER_BASE_IMAGE) .

.PHONY: docker-push
Expand All @@ -354,7 +361,11 @@ docker-save: ## Save the container image with the manager.
docker save $(IMG) | gzip > $(IMAGE_NAME).tar.gz

.PHONY: docker-build-utils
docker-build-utils: ## Build docker image for utils container.
docker-build-utils: ## Build and push multi-arch docker image for utils container.
docker buildx build --platform $(PLATFORMS) -t $(UTILS_IMG) --label HOURLY_TAG=$(HOURLY_TAG_LABEL) -f internal/utils_container/Dockerfile --push .

.PHONY: docker-build-utils-local
docker-build-utils-local: ## Build utils docker image locally for current architecture only (no push).
DOCKER_BUILDKIT=1 docker build -t $(UTILS_IMG) --label HOURLY_TAG=$(HOURLY_TAG_LABEL) -f internal/utils_container/Dockerfile .

.PHONY: docker-push-utils
Expand Down
7 changes: 4 additions & 3 deletions internal/utils_container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ RUN microdnf install -y util-linux pciutils kmod tar jq systemd && \

ADD LICENSE /licenses/LICENSE

# Install kubectl and oc
# Install kubectl and oc with architecture detection
ARG TARGETARCH
RUN mkdir -p /oc && cd /oc && \
curl -SsLO 'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-amd64-rhel9.tar.gz' && \
tar -xzf openshift-client-linux-amd64-rhel9.tar.gz -C /oc && \
curl -SsLO "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-${TARGETARCH}-rhel9.tar.gz" && \
tar -xzf openshift-client-linux-${TARGETARCH}-rhel9.tar.gz -C /oc && \
cp ./kubectl /usr/local/bin && chmod +x /usr/local/bin/kubectl && \
cp ./oc /usr/local/bin && chmod +x /usr/local/bin/oc && \
rm -rf /oc
Expand Down