From b1af04363b2fd3cc00e02fb0d6ecaf63954f80f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Sch=C3=BCnemann?= Date: Wed, 30 Jul 2025 12:54:50 +0200 Subject: [PATCH] feat: own Dockerfile with ocm cli --- Dockerfile | 25 +++++++++++++++++++++++++ Taskfile.yaml | 1 + renovate.json | 12 ++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5a70e69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# Stage 1: Download and extract ocm binary +FROM alpine AS downloader +ARG TARGETOS +ARG TARGETARCH +RUN apk add --no-cache curl tar +WORKDIR /tmp +# renovate: datasource=github-releases depName=ocm packageName=open-component-model/ocm +ARG OCM_VERSION=0.27.0 +RUN curl -L -o ocm.tar.gz https://github.com/open-component-model/ocm/releases/download/v$OCM_VERSION/ocm-$OCM_VERSION-$TARGETOS-$TARGETARCH.tar.gz \ + && tar -xzf ocm.tar.gz + +# Use distroless as minimal base image to package the component binary +# Refer to https://github.com/GoogleContainerTools/distroless for more details +FROM gcr.io/distroless/static-debian12:nonroot@sha256:627d6c5a23ad24e6bdff827f16c7b60e0289029b0c79e9f7ccd54ae3279fb45f +ARG TARGETOS +ARG TARGETARCH +ARG COMPONENT +WORKDIR / +COPY bin/$COMPONENT.$TARGETOS-$TARGETARCH / +# Copy ocm binary from downloader stage (adjust path if needed) +COPY --from=downloader /tmp/ocm /usr/local/bin/ocm +USER 65532:65532 + +# docker doesn't substitue args in ENTRYPOINT, so we replace this during the build script +ENTRYPOINT ["/"] diff --git a/Taskfile.yaml b/Taskfile.yaml index 95d3144..042dcad 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -14,3 +14,4 @@ includes: REPO_URL: 'https://github.com/openmcp-project/bootstrapper' GENERATE_DOCS_INDEX: "true" CHART_COMPONENTS: "[]" + DOCKERFILE: '{{.ROOT_DIR}}/Dockerfile' diff --git a/renovate.json b/renovate.json index b81e603..5dbcc4d 100644 --- a/renovate.json +++ b/renovate.json @@ -36,5 +36,17 @@ "minimumReleaseAge": "0 days", "enabled": true } + ], + "customManagers": [ + { + "description": "All component dependencies and their versions used in the Dockerfile.", + "customType": "regex", + "managerFilePatterns": [ + "/Dockerfile/" + ], + "matchStrings": [ + "# renovate: datasource=(?[a-z-.]+?) depName=(?[^\\s]+?)(?: (lookupName|packageName)=(?[^\\s]+?))?(?: versioning=(?[^\\s]+?))?(?: extractVersion=(?[^\\s]+?))?(?: registryUrl=(?[^\\s]+?))?\\s.+?(_version|_VERSION)=\"?(?.+?)\"?\\s" + ] + } ] }