From 750a2ed3b202901db02c77c303402caa43974729 Mon Sep 17 00:00:00 2001 From: Subbarao Meduri Date: Wed, 8 May 2024 15:17:32 -0400 Subject: [PATCH] Create Containerfile.operator files in preparation to move to RHTAP (#102) * Create Containerfile.operator files in preparation to move to RHTAP Signed-off-by: Subbarao Meduri * refactor to override specific targets Signed-off-by: Subbarao Meduri --------- Signed-off-by: Subbarao Meduri --- Containerfile.operator | 22 ++++++++++++++++++++++ Makefile.rhtap | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Containerfile.operator create mode 100644 Makefile.rhtap diff --git a/Containerfile.operator b/Containerfile.operator new file mode 100644 index 0000000000..c326efdfcd --- /dev/null +++ b/Containerfile.operator @@ -0,0 +1,22 @@ +# Copyright Contributors to the Open Cluster Management project +# Licensed under the Apache License 2.0 + +FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.20 AS builder + +WORKDIR $GOPATH/src/github.com/thanos-io/thanos + +COPY . $GOPATH/src/github.com/thanos-io/thanos + +RUN git update-index --refresh; make build -f Makefile.rhtap + +# ----------------------------------------------------------------------------- + +FROM registry.access.redhat.com/ubi8/ubi-minimal:latest + +LABEL maintainer="The ACM Thanos maintainers" + +COPY --from=builder /go/bin/thanos /bin/thanos + +RUN microdnf update -y && microdnf clean all + +ENTRYPOINT [ "/bin/thanos" ] diff --git a/Makefile.rhtap b/Makefile.rhtap new file mode 100644 index 0000000000..033cf23e29 --- /dev/null +++ b/Makefile.rhtap @@ -0,0 +1,23 @@ +include Makefile + +# Override build, crossbuild targets from Makefile +# to use promu to build dynamic binaries +.PHONY: build +build: ## Builds Thanos binary using `promu`. +build: check-git deps $(PROMU) + @echo ">> building Thanos binary in $(PREFIX)" + @go mod vendor && $(PROMU) -c ".promu.prow.yaml" build -v --cgo --prefix $(PREFIX) + +GIT_BRANCH=$(shell $(GIT) rev-parse --abbrev-ref HEAD) +.PHONY: crossbuild +crossbuild: ## Builds all binaries for all platforms. +ifeq ($(GIT_BRANCH), main) +crossbuild: | $(PROMU) + @echo ">> crossbuilding all binaries" + # we only care about below two for the main branch + @go mod vendor && $(PROMU) -c ".promu.prow.yaml" crossbuild -v --cgo -p linux/amd64 +else +crossbuild: | $(PROMU) + @echo ">> crossbuilding all binaries" + @go mod vendor && $(PROMU) -c ".promu.prow.yaml" crossbuild -v --cgo +endif \ No newline at end of file