From 75ca28fc9525555544bee702bb9223a5ed66c8b3 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Tue, 9 Dec 2025 08:24:34 +0600 Subject: [PATCH] Build ubi image Signed-off-by: Tamal Saha --- Dockerfile.ubi | 33 +++++++++++++++++++++++++++++++++ Makefile | 17 +++++++++++------ README.md | 2 +- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 Dockerfile.ubi diff --git a/Dockerfile.ubi b/Dockerfile.ubi new file mode 100644 index 00000000..702715bf --- /dev/null +++ b/Dockerfile.ubi @@ -0,0 +1,33 @@ +# Copyright AppsCode Inc. and Contributors +# +# Licensed under the AppsCode Community License 1.0.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM {ARG_FROM} + +LABEL org.opencontainers.image.source="https://github.com/kubeops/taskqueue" \ + name="TaskQueue" \ + maintainer=AppsCode \ + vendor=AppsCode \ + version={ARG_TAG} \ + release={ARG_TAG} \ + summary="TaskQueue is a Kubernetes controller that manages a queue of tasks" \ + description="TaskQueue is a Kubernetes controller that manages a queue of tasks. It is designed to be used task processing system by mainting a queue with max concurrent task at a time." + +RUN mkdir -p /licenses +COPY LICENSE.md /licenses/ + +ADD bin/{ARG_BIN}-{ARG_OS}-{ARG_ARCH} /{ARG_BIN} + +USER 65534 + +ENTRYPOINT ["/{ARG_BIN}"] \ No newline at end of file diff --git a/Makefile b/Makefile index ea5edcf9..a6fd932e 100644 --- a/Makefile +++ b/Makefile @@ -68,13 +68,16 @@ ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH)) BASEIMAGE_PROD ?= alpine BASEIMAGE_DBG ?= debian:12 +BASEIMAGE_UBI ?= registry.access.redhat.com/ubi10/ubi-minimal IMAGE := $(if $(FQDN),$(FQDN)/,)$(REGISTRY)/$(BIN) VERSION_PROD := $(VERSION) VERSION_DBG := $(VERSION)-dbg +VERSION_UBI := $(VERSION)-ubi TAG := $(VERSION)_$(OS)_$(ARCH) TAG_PROD := $(TAG) TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH) +TAG_UBI := $(VERSION)-ubi_$(OS)_$(ARCH) GO_VERSION ?= 1.25 BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION) @@ -96,6 +99,7 @@ BUILD_DIRS := bin/$(OS)_$(ARCH) \ DOCKERFILE_PROD = Dockerfile.in DOCKERFILE_DBG = Dockerfile.dbg +DOCKERFILE_UBI = Dockerfile.ubi DOCKER_REPO_ROOT := /go/src/$(GO_PKG)/$(REPO) @@ -223,15 +227,16 @@ endif # Used to track state in hidden files. DOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(TAG) -container: bin/.container-$(DOTFILE_IMAGE)-PROD bin/.container-$(DOTFILE_IMAGE)-DBG +container: bin/.container-$(DOTFILE_IMAGE)-PROD bin/.container-$(DOTFILE_IMAGE)-DBG bin/.container-$(DOTFILE_IMAGE)-UBI ifeq (,$(SRC_REG)) bin/.container-$(DOTFILE_IMAGE)-%: bin/$(BIN)-$(OS)-$(ARCH) $(DOCKERFILE_%) @echo "container: $(IMAGE):$(TAG_$*)" - @sed \ + @sed \ -e 's|{ARG_BIN}|$(BIN)|g' \ -e 's|{ARG_ARCH}|$(ARCH)|g' \ -e 's|{ARG_OS}|$(OS)|g' \ -e 's|{ARG_FROM}|$(BASEIMAGE_$*)|g' \ + -e 's|{ARG_TAG}|$(TAG)|g' \ $(DOCKERFILE_$*) > bin/.dockerfile-$*-$(OS)_$(ARCH) @docker buildx build --platform $(OS)/$(ARCH) --load --pull -t $(IMAGE):$(TAG_$*) -f bin/.dockerfile-$*-$(OS)_$(ARCH) . @docker images -q $(IMAGE):$(TAG_$*) > $@ @@ -243,17 +248,17 @@ bin/.container-$(DOTFILE_IMAGE)-%: @echo endif -push: bin/.push-$(DOTFILE_IMAGE)-PROD bin/.push-$(DOTFILE_IMAGE)-DBG +push: bin/.push-$(DOTFILE_IMAGE)-PROD bin/.push-$(DOTFILE_IMAGE)-DBG bin/.push-$(DOTFILE_IMAGE)-UBI bin/.push-$(DOTFILE_IMAGE)-%: bin/.container-$(DOTFILE_IMAGE)-% @docker push $(IMAGE):$(TAG_$*) @echo "pushed: $(IMAGE):$(TAG_$*)" @echo .PHONY: docker-manifest -docker-manifest: docker-manifest-PROD docker-manifest-DBG +docker-manifest: docker-manifest-PROD docker-manifest-DBG docker-manifest-UBI docker-manifest-%: - docker manifest create -a $(IMAGE):$(VERSION_$*) $(foreach PLATFORM,$(DOCKER_PLATFORMS),$(IMAGE):$(VERSION_$*)_$(subst /,_,$(PLATFORM))) - docker manifest push $(IMAGE):$(VERSION_$*) + @docker manifest create -a $(IMAGE):$(VERSION_$*) $(foreach PLATFORM,$(DOCKER_PLATFORMS),$(IMAGE):$(VERSION_$*)_$(subst /,_,$(PLATFORM))) + @docker manifest push $(IMAGE):$(VERSION_$*) .PHONY: test test: unit-tests diff --git a/README.md b/README.md index b0ff2f26..f3a44e33 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # taskqueue -KubeOps TaskQueue is a Kubernetes controller that manages a queue of tasks. It is designed to be used task processing system by mainting a queue with max concurrent task at a time. +TaskQueue is a Kubernetes controller that manages a queue of tasks. It is designed to be used task processing system by mainting a queue with max concurrent task at a time. ## Deploy into a Kubernetes Cluster