Skip to content
Merged
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
41 changes: 41 additions & 0 deletions Dockerfile.ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright AppsCode Inc. and Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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/pgoutbox" \
name="pgoutbox" \
maintainer=AppsCode \
vendor=AppsCode \
version={ARG_TAG} \
release={ARG_TAG} \
summary="Implements Outbox pattern for PostgreSQL" \
description="Implements Outbox pattern for PostgreSQL"

RUN mkdir -p /licenses
COPY LICENSE /licenses/

RUN set -x \
&& microdnf update -y \
&& microdnf install -y ca-certificates tzdata \
&& microdnf clean all

ENV TZ=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

ADD bin/{ARG_BIN}-{ARG_OS}-{ARG_ARCH} /{ARG_BIN}

USER 65534

ENTRYPOINT ["/{ARG_BIN}"]
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ 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 := $(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.24
GO_VERSION ?= 1.25
BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)
CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v3.11.0
CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v3.13.0

OUTBIN = bin/$(BIN)-$(OS)-$(ARCH)
ifeq ($(OS),windows)
Expand All @@ -93,6 +96,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)

Expand Down Expand Up @@ -220,15 +224,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_$*) > $@
Expand All @@ -240,17 +245,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
Expand Down
Loading