Skip to content

Commit f89109e

Browse files
committed
Build ubi image
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent e1ba311 commit f89109e

File tree

4 files changed

+54
-8
lines changed

4 files changed

+54
-8
lines changed

Dockerfile.dbg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FROM ghcr.io/appscode/dlv:1.25
1616

1717
FROM {ARG_FROM}
1818

19-
LABEL org.opencontainers.image.source https://github.com/bytebuilders/cli
19+
LABEL org.opencontainers.image.source https://github.com/appscode-cloud/cli
2020

2121
RUN set -x \
2222
&& apt-get update \

Dockerfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
FROM {ARG_FROM}
1616

17-
LABEL org.opencontainers.image.source https://github.com/bytebuilders/cli
17+
LABEL org.opencontainers.image.source https://github.com/appscode-cloud/cli
1818

1919
RUN set -x \
2020
&& apk add --update --upgrade --no-cache pcre2 ca-certificates tzdata openssh-client \

Dockerfile.ubi

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright AppsCode Inc. and Contributors
2+
#
3+
# Licensed under the AppsCode Community License 1.0.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM {ARG_FROM}
16+
17+
LABEL org.opencontainers.image.source="https://github.com/appscode-cloud/cli" \
18+
name="ACE Cli" \
19+
maintainer=AppsCode \
20+
vendor=AppsCode \
21+
version={ARG_TAG} \
22+
release={ARG_TAG} \
23+
summary="ACE cli" \
24+
description="ACE cli"
25+
26+
RUN mkdir -p /licenses
27+
COPY LICENSE.md /licenses/
28+
29+
RUN set -x \
30+
&& microdnf update -y \
31+
&& microdnf install -y ca-certificates tzdata openssh-clients \
32+
&& microdnf clean all
33+
34+
ENV TZ=Etc/UTC
35+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
36+
37+
ADD bin/{ARG_BIN}-{ARG_OS}-{ARG_ARCH} /{ARG_BIN}
38+
39+
USER 65534
40+
41+
ENTRYPOINT ["/{ARG_BIN}"]

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
6363

6464
BASEIMAGE_PROD ?= alpine
6565
BASEIMAGE_DBG ?= debian:12
66+
BASEIMAGE_UBI ?= registry.access.redhat.com/ubi10/ubi-minimal
6667

6768
IMAGE := $(REGISTRY)/$(BIN)
6869
VERSION_PROD := $(VERSION)
6970
VERSION_DBG := $(VERSION)-dbg
71+
VERSION_UBI := $(VERSION)-ubi
7072
TAG := $(VERSION)_$(OS)_$(ARCH)
7173
TAG_PROD := $(TAG)
7274
TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH)
75+
TAG_UBI := $(VERSION)-ubi_$(OS)_$(ARCH)
7376

7477
GO_VERSION ?= 1.25
7578
BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)
@@ -91,6 +94,7 @@ BUILD_DIRS := bin/$(OS)_$(ARCH) \
9194

9295
DOCKERFILE_PROD = Dockerfile.in
9396
DOCKERFILE_DBG = Dockerfile.dbg
97+
DOCKERFILE_UBI = Dockerfile.ubi
9498

9599
DOCKER_REPO_ROOT := /go/src/$(GO_PKG)/$(REPO)
96100

@@ -218,15 +222,16 @@ endif
218222
# Used to track state in hidden files.
219223
DOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(TAG)
220224

221-
container: bin/.container-$(DOTFILE_IMAGE)-PROD bin/.container-$(DOTFILE_IMAGE)-DBG
225+
container: bin/.container-$(DOTFILE_IMAGE)-PROD bin/.container-$(DOTFILE_IMAGE)-DBG bin/.container-$(DOTFILE_IMAGE)-UBI
222226
ifeq (,$(SRC_REG))
223227
bin/.container-$(DOTFILE_IMAGE)-%: bin/$(BIN)-$(OS)-$(ARCH) $(DOCKERFILE_%)
224228
@echo "container: $(IMAGE):$(TAG_$*)"
225-
@sed \
229+
@sed \
226230
-e 's|{ARG_BIN}|$(BIN)|g' \
227231
-e 's|{ARG_ARCH}|$(ARCH)|g' \
228232
-e 's|{ARG_OS}|$(OS)|g' \
229233
-e 's|{ARG_FROM}|$(BASEIMAGE_$*)|g' \
234+
-e 's|{ARG_TAG}|$(TAG)|g' \
230235
$(DOCKERFILE_$*) > bin/.dockerfile-$*-$(OS)_$(ARCH)
231236
@docker buildx build --platform $(OS)/$(ARCH) --load --pull -t $(IMAGE):$(TAG_$*) -f bin/.dockerfile-$*-$(OS)_$(ARCH) .
232237
@docker images -q $(IMAGE):$(TAG_$*) > $@
@@ -238,17 +243,17 @@ bin/.container-$(DOTFILE_IMAGE)-%:
238243
@echo
239244
endif
240245

241-
push: bin/.push-$(DOTFILE_IMAGE)-PROD bin/.push-$(DOTFILE_IMAGE)-DBG
246+
push: bin/.push-$(DOTFILE_IMAGE)-PROD bin/.push-$(DOTFILE_IMAGE)-DBG bin/.push-$(DOTFILE_IMAGE)-UBI
242247
bin/.push-$(DOTFILE_IMAGE)-%: bin/.container-$(DOTFILE_IMAGE)-%
243248
@docker push $(IMAGE):$(TAG_$*)
244249
@echo "pushed: $(IMAGE):$(TAG_$*)"
245250
@echo
246251

247252
.PHONY: docker-manifest
248-
docker-manifest: docker-manifest-PROD docker-manifest-DBG
253+
docker-manifest: docker-manifest-PROD docker-manifest-DBG docker-manifest-UBI
249254
docker-manifest-%:
250-
docker manifest create -a $(IMAGE):$(VERSION_$*) $(foreach PLATFORM,$(DOCKER_PLATFORMS),$(IMAGE):$(VERSION_$*)_$(subst /,_,$(PLATFORM)))
251-
docker manifest push $(IMAGE):$(VERSION_$*)
255+
@docker manifest create -a $(IMAGE):$(VERSION_$*) $(foreach PLATFORM,$(DOCKER_PLATFORMS),$(IMAGE):$(VERSION_$*)_$(subst /,_,$(PLATFORM)))
256+
@docker manifest push $(IMAGE):$(VERSION_$*)
252257

253258
.PHONY: test
254259
test: unit-tests

0 commit comments

Comments
 (0)