Auto-detects podman or docker, with override via CONTAINER_ENGINE. Podman uses 'podman build', docker uses 'docker buildx build --load'.
120 lines
3.8 KiB
Makefile
120 lines
3.8 KiB
Makefile
# KubeRay Images Makefile
|
|
# Build and push GPU-specific Ray worker images
|
|
|
|
REGISTRY := git.daviestechlabs.io/daviestechlabs
|
|
TAG := latest
|
|
PLATFORM := linux/amd64
|
|
|
|
# Container runtime: auto-detect podman or docker
|
|
# Override with: make CONTAINER_ENGINE=podman
|
|
CONTAINER_ENGINE := $(shell command -v podman >/dev/null 2>&1 && echo podman || echo docker)
|
|
|
|
# Image names
|
|
IMAGES := ray-worker-nvidia ray-worker-rdna2 ray-worker-strixhalo ray-worker-intel
|
|
|
|
.PHONY: all build-all push-all clean help lint $(addprefix build-,$(IMAGES)) $(addprefix push-,$(IMAGES))
|
|
|
|
help:
|
|
@echo "KubeRay Images Build System"
|
|
@echo ""
|
|
@echo "Usage:"
|
|
@echo " make build-all Build all images"
|
|
@echo " make push-all Push all images to registry"
|
|
@echo " make build-nvidia Build NVIDIA worker image"
|
|
@echo " make build-rdna2 Build AMD RDNA2 worker image"
|
|
@echo " make build-strixhalo Build AMD Strix Halo worker image"
|
|
@echo " make build-intel Build Intel XPU worker image"
|
|
@echo " make push-nvidia Push NVIDIA worker image"
|
|
@echo " make lint Lint Dockerfiles with hadolint"
|
|
@echo " make TAG=v1.0.0 push-all Push with specific tag"
|
|
@echo " make CONTAINER_ENGINE=podman build-all Use podman instead of docker"
|
|
@echo ""
|
|
@echo "Environment:"
|
|
@echo " CONTAINER_ENGINE=$(CONTAINER_ENGINE)"
|
|
@echo " REGISTRY=$(REGISTRY)"
|
|
@echo " TAG=$(TAG)"
|
|
@echo " PLATFORM=$(PLATFORM)"
|
|
|
|
# Lint Dockerfiles with hadolint
|
|
lint:
|
|
@echo "Linting Dockerfiles..."
|
|
@command -v hadolint >/dev/null 2>&1 || { echo "hadolint not found, skipping..."; exit 0; }
|
|
hadolint dockerfiles/Dockerfile.ray-worker-nvidia
|
|
hadolint dockerfiles/Dockerfile.ray-worker-rdna2
|
|
hadolint dockerfiles/Dockerfile.ray-worker-strixhalo
|
|
hadolint dockerfiles/Dockerfile.ray-worker-intel
|
|
@echo "Lint passed!"
|
|
|
|
# Build targets - works with both docker buildx and podman build
|
|
# Podman uses 'build' directly, docker uses 'buildx build'
|
|
ifeq ($(CONTAINER_ENGINE),podman)
|
|
BUILD_CMD = $(CONTAINER_ENGINE) build --platform $(PLATFORM)
|
|
else
|
|
BUILD_CMD = $(CONTAINER_ENGINE) buildx build --platform $(PLATFORM) --load
|
|
endif
|
|
|
|
build-nvidia:
|
|
$(BUILD_CMD) \
|
|
--tag $(REGISTRY)/ray-worker-nvidia:$(TAG) \
|
|
--file dockerfiles/Dockerfile.ray-worker-nvidia \
|
|
.
|
|
|
|
build-rdna2:
|
|
$(BUILD_CMD) \
|
|
--tag $(REGISTRY)/ray-worker-rdna2:$(TAG) \
|
|
--file dockerfiles/Dockerfile.ray-worker-rdna2 \
|
|
.
|
|
|
|
build-strixhalo:
|
|
$(BUILD_CMD) \
|
|
--tag $(REGISTRY)/ray-worker-strixhalo:$(TAG) \
|
|
--file dockerfiles/Dockerfile.ray-worker-strixhalo \
|
|
.
|
|
|
|
build-intel:
|
|
$(BUILD_CMD) \
|
|
--tag $(REGISTRY)/ray-worker-intel:$(TAG) \
|
|
--file dockerfiles/Dockerfile.ray-worker-intel \
|
|
.
|
|
|
|
build-all: build-nvidia build-rdna2 build-strixhalo build-intel
|
|
@echo "All images built successfully"
|
|
|
|
# Push targets
|
|
push-nvidia:
|
|
$(CONTAINER_ENGINE) push $(REGISTRY)/ray-worker-nvidia:$(TAG)
|
|
|
|
push-rdna2:
|
|
$(CONTAINER_ENGINE) push $(REGISTRY)/ray-worker-rdna2:$(TAG)
|
|
|
|
push-strixhalo:
|
|
$(CONTAINER_ENGINE) push $(REGISTRY)/ray-worker-strixhalo:$(TAG)
|
|
|
|
push-intel:
|
|
$(CONTAINER_ENGINE) push $(REGISTRY)/ray-worker-intel:$(TAG)
|
|
|
|
push-all: push-nvidia push-rdna2 push-strixhalo push-intel
|
|
@echo "All images pushed successfully"
|
|
|
|
# Tag and push with both latest and version tag
|
|
release:
|
|
ifndef VERSION
|
|
$(error VERSION is not set. Usage: make VERSION=v1.0.0 release)
|
|
endif
|
|
@echo "Releasing version $(VERSION)"
|
|
$(MAKE) TAG=$(VERSION) build-all
|
|
$(MAKE) TAG=$(VERSION) push-all
|
|
$(MAKE) TAG=latest build-all
|
|
$(MAKE) TAG=latest push-all
|
|
|
|
# Login to registry
|
|
login:
|
|
$(CONTAINER_ENGINE) login $(REGISTRY)
|
|
|
|
# Clean local images
|
|
clean:
|
|
-$(CONTAINER_ENGINE) rmi $(REGISTRY)/ray-worker-nvidia:$(TAG)
|
|
-$(CONTAINER_ENGINE) rmi $(REGISTRY)/ray-worker-rdna2:$(TAG)
|
|
-$(CONTAINER_ENGINE) rmi $(REGISTRY)/ray-worker-strixhalo:$(TAG)
|
|
-$(CONTAINER_ENGINE) rmi $(REGISTRY)/ray-worker-intel:$(TAG)
|