Skip to content

Commit 8da5100

Browse files
committed
chore(containers): add container image using ubi-micro
Add a new container stage that use ubi-micro as the base to create a Red Hat base image for the plugin Signed-off-by: Jonathan Gonzalez V. <[email protected]>
1 parent b854830 commit 8da5100

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

Taskfile.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,13 @@ tasks:
159159
cmds:
160160
- >
161161
GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
162-
build --dir . --file containers/Dockerfile.plugin --platform linux/amd64
162+
build --dir . --file containers/Dockerfile.plugin --platform linux/amd64 --target distroless
163163
publish --ref ${REGISTRY_NAME}:${REGISTRY_PORT}/plugin-barman-cloud --tags testing
164164
165+
GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
166+
build --dir . --file containers/Dockerfile.plugin --platform linux/amd64 --target distroless-ubi9
167+
publish --ref ${REGISTRY_NAME}:${REGISTRY_PORT}/plugin-barman-cloud --tags testing-ubi9
168+
165169
# We build an image and push it to a local registry.
166170
# The name is always `sidecar-barman-cloud:testing`.
167171
build-sidecar-image:

containers/Dockerfile.plugin

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache
2626

2727
# Use distroless as minimal base image to package the manager binary
2828
# Refer to https://github.com/GoogleContainerTools/distroless for more details
29-
FROM gcr.io/distroless/static:nonroot
29+
FROM gcr.io/distroless/static:nonroot AS distroless
3030

3131
ENV SUMMARY="CloudNativePG Barman plugin" \
3232
DESCRIPTION="Container image that provides the barman-cloud plugin"
@@ -35,7 +35,7 @@ LABEL summary="$SUMMARY" \
3535
description="$DESCRIPTION" \
3636
io.k8s.display-name="$SUMMARY" \
3737
io.k8s.description="$DESCRIPTION" \
38-
name="CloudNativePG Barman plugin" \
38+
name="$SUMMARY" \
3939
vendor="CloudNativePG Contributors" \
4040
url="https://cloudnative-pg.io/" \
4141
version="" \
@@ -45,4 +45,27 @@ WORKDIR /
4545
COPY --from=gobuilder /workspace/manager .
4646
USER 65532:65532
4747

48-
ENTRYPOINT ["/manager"]
48+
ENTRYPOINT ["/manager"]
49+
50+
# Use ubi9-micro as minimal base image to package the manager binary
51+
# Refer to for more details
52+
FROM registry.access.redhat.com/ubi9/ubi-micro AS distroless-ubi9
53+
54+
ENV SUMMARY="CloudNativePG Barman plugin" \
55+
DESCRIPTION="Container image that provides the barman-cloud plugin"
56+
57+
LABEL summary="$SUMMARY" \
58+
description="$DESCRIPTION" \
59+
io.k8s.display-name="$SUMMARY" \
60+
io.k8s.description="$DESCRIPTION" \
61+
name="$SUMMARY" \
62+
vendor="CloudNativePG Contributors" \
63+
url="https://cloudnative-pg.io/" \
64+
version="" \
65+
release="1"
66+
67+
WORKDIR /
68+
COPY --from=gobuilder /workspace/manager .
69+
USER 65532:65532
70+
71+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)