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
60 changes: 44 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,75 @@ LABELLER_TAG ?= labeller-$(IMAGE_VERSION)
UBI_DEVICE_PLUGIN_TAG ?= rhubi-$(IMAGE_VERSION)
UBI_LABELLER_TAG ?= labeller-rhubi-$(IMAGE_VERSION)

# Multi-architecture support
PLATFORMS ?= linux/amd64,linux/ppc64le

# Output directory for tar.gz files
OUTPUT_DIR ?= ./dist
TAR_DIR ?= $(OUTPUT_DIR)/tarballs

.PHONY: all build-all save-all clean help
.PHONY: build-device-plugin build-labeller build-ubi-device-plugin build-ubi-labeller
.PHONY: build-device-plugin-local build-labeller-local build-ubi-device-plugin-local build-ubi-labeller-local
.PHONY: save-device-plugin save-labeller save-ubi-device-plugin save-ubi-labeller

# Default target
all: build-all save-all

# Build all images
# Build all images (multi-arch with push)
build-all: build-device-plugin build-labeller build-ubi-device-plugin build-ubi-labeller
@echo "All images built successfully"

# Save all images to tar.gz
save-all: save-device-plugin save-labeller save-ubi-device-plugin save-ubi-labeller
@echo "All images saved to $(TAR_DIR)/"

# Build Alpine-based device plugin image
# Build Alpine-based device plugin image (multi-arch with push)
build-device-plugin:
@echo "Building Alpine-based device plugin image..."
docker build -t $(IMAGE_REPO):$(DEVICE_PLUGIN_TAG) -f Dockerfile .
@echo "Built: $(IMAGE_REPO):$(DEVICE_PLUGIN_TAG)"
@echo "Building multi-arch Alpine-based device plugin image..."
docker buildx build --platform $(PLATFORMS) -t $(IMAGE_REPO):$(DEVICE_PLUGIN_TAG) -f Dockerfile --push .
@echo "Built and pushed: $(IMAGE_REPO):$(DEVICE_PLUGIN_TAG)"

# Build Alpine-based node labeller image
# Build Alpine-based node labeller image (multi-arch with push)
build-labeller:
@echo "Building Alpine-based node labeller image..."
docker build -t $(IMAGE_REPO):$(LABELLER_TAG) -f labeller.Dockerfile .
@echo "Built: $(IMAGE_REPO):$(LABELLER_TAG)"
@echo "Building multi-arch Alpine-based node labeller image..."
docker buildx build --platform $(PLATFORMS) -t $(IMAGE_REPO):$(LABELLER_TAG) -f labeller.Dockerfile --push .
@echo "Built and pushed: $(IMAGE_REPO):$(LABELLER_TAG)"

# Build UBI-based device plugin image
# Build UBI-based device plugin image (multi-arch with push)
build-ubi-device-plugin:
@echo "Building UBI-based device plugin image..."
docker build -t $(IMAGE_REPO):$(UBI_DEVICE_PLUGIN_TAG) -f ubi-dp.Dockerfile .
@echo "Built: $(IMAGE_REPO):$(UBI_DEVICE_PLUGIN_TAG)"
@echo "Building multi-arch UBI-based device plugin image..."
docker buildx build --platform $(PLATFORMS) -t $(IMAGE_REPO):$(UBI_DEVICE_PLUGIN_TAG) -f ubi-dp.Dockerfile --push .
@echo "Built and pushed: $(IMAGE_REPO):$(UBI_DEVICE_PLUGIN_TAG)"

# Build UBI-based node labeller image
# Build UBI-based node labeller image (multi-arch with push)
build-ubi-labeller:
@echo "Building UBI-based node labeller image..."
docker build -t $(IMAGE_REPO):$(UBI_LABELLER_TAG) -f ubi-labeller.Dockerfile .
@echo "Building multi-arch UBI-based node labeller image..."
docker buildx build --platform $(PLATFORMS) -t $(IMAGE_REPO):$(UBI_LABELLER_TAG) -f ubi-labeller.Dockerfile --push .
@echo "Built and pushed: $(IMAGE_REPO):$(UBI_LABELLER_TAG)"

# Build Alpine-based device plugin image (local, single-arch, no push)
build-device-plugin-local:
@echo "Building local Alpine-based device plugin image..."
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_REPO):$(DEVICE_PLUGIN_TAG) -f Dockerfile .
@echo "Built: $(IMAGE_REPO):$(DEVICE_PLUGIN_TAG)"

# Build Alpine-based node labeller image (local, single-arch, no push)
build-labeller-local:
@echo "Building local Alpine-based node labeller image..."
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_REPO):$(LABELLER_TAG) -f labeller.Dockerfile .
@echo "Built: $(IMAGE_REPO):$(LABELLER_TAG)"

# Build UBI-based device plugin image (local, single-arch, no push)
build-ubi-device-plugin-local:
@echo "Building local UBI-based device plugin image..."
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_REPO):$(UBI_DEVICE_PLUGIN_TAG) -f ubi-dp.Dockerfile .
@echo "Built: $(IMAGE_REPO):$(UBI_DEVICE_PLUGIN_TAG)"

# Build UBI-based node labeller image (local, single-arch, no push)
build-ubi-labeller-local:
@echo "Building local UBI-based node labeller image..."
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_REPO):$(UBI_LABELLER_TAG) -f ubi-labeller.Dockerfile .
@echo "Built: $(IMAGE_REPO):$(UBI_LABELLER_TAG)"

# Save Alpine device plugin image to tar.gz
Expand Down
24 changes: 15 additions & 9 deletions ubi-dp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM registry.access.redhat.com/ubi9/ubi:latest as builder
ARG TARGETARCH
USER root
RUN dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/ && \
RUN CENTOS_ARCH=${TARGETARCH}; \
if [ "$CENTOS_ARCH" = "amd64" ]; then CENTOS_ARCH="x86_64"; fi; \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/BaseOS/${CENTOS_ARCH}/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/AppStream/${CENTOS_ARCH}/os/ && \
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official && \
dnf install git pkgconfig gcc gcc-c++ make glibc-devel binutils libdrm-devel hwloc-devel wget tar gzip -y && \
dnf clean all
RUN wget https://golang.org/dl/go1.23.3.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.23.3.linux-amd64.tar.gz && \
rm go1.23.3.linux-amd64.tar.gz
RUN wget https://golang.org/dl/go1.23.3.linux-${TARGETARCH}.tar.gz && \
tar -C /usr/local -xzf go1.23.3.linux-${TARGETARCH}.tar.gz && \
rm go1.23.3.linux-${TARGETARCH}.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/go"
RUN mkdir -p /go/src/github.com/ROCm/k8s-device-plugin
Expand All @@ -40,12 +43,15 @@ LABEL \
release="latest" \
summary="The AMD K8s Device Plugin enables the registration of AMD GPUs in your Kubernetes cluster for compute workloads." \
description="The AMD K8s Device Plugin enables the registration of AMD GPUs in your Kubernetes cluster for compute workloads. With the appropriate hardware and this plugin deployed in your Kubernetes cluster, you will be able to run jobs that require AMD GPU."
RUN mkdir -p /licenses && \
ARG TARGETARCH
RUN CENTOS_ARCH=${TARGETARCH}; \
if [ "$CENTOS_ARCH" = "amd64" ]; then CENTOS_ARCH="x86_64"; fi; \
mkdir -p /licenses && \
dnf install -y ca-certificates libdrm && \
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official && \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/BaseOS/${CENTOS_ARCH}/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/AppStream/${CENTOS_ARCH}/os/ && \
dnf install -y hwloc && \
dnf clean all
ADD ./LICENSE /licenses/LICENSE
Expand Down
15 changes: 9 additions & 6 deletions ubi-labeller.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM registry.access.redhat.com/ubi9/ubi:latest as builder
ARG TARGETARCH
USER root
RUN dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/ && \
RUN CENTOS_ARCH=${TARGETARCH}; \
if [ "$CENTOS_ARCH" = "amd64" ]; then CENTOS_ARCH="x86_64"; fi; \
dnf install -y 'dnf-command(config-manager)' && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/BaseOS/${CENTOS_ARCH}/os/ && \
dnf config-manager --add-repo=https://mirror.stream.centos.org/9-stream/AppStream/${CENTOS_ARCH}/os/ && \
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official && \
dnf install git pkgconfig gcc gcc-c++ make glibc-devel binutils libdrm-devel wget tar gzip -y && \
dnf clean all
RUN wget https://golang.org/dl/go1.23.3.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.23.3.linux-amd64.tar.gz && \
rm go1.23.3.linux-amd64.tar.gz
RUN wget https://golang.org/dl/go1.23.3.linux-${TARGETARCH}.tar.gz && \
tar -C /usr/local -xzf go1.23.3.linux-${TARGETARCH}.tar.gz && \
rm go1.23.3.linux-${TARGETARCH}.tar.gz
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/go"
RUN mkdir -p /go/src/github.com/ROCm/k8s-device-plugin
Expand Down