Skip to content

Commit 1613b57

Browse files
authored
feat: own Dockerfile with ocm cli (#4)
1 parent bea07a8 commit 1613b57

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Stage 1: Download and extract ocm binary
2+
FROM alpine AS downloader
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
RUN apk add --no-cache curl tar
6+
WORKDIR /tmp
7+
# renovate: datasource=github-releases depName=ocm packageName=open-component-model/ocm
8+
ARG OCM_VERSION=0.27.0
9+
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 \
10+
&& tar -xzf ocm.tar.gz
11+
12+
# Use distroless as minimal base image to package the component binary
13+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
14+
FROM gcr.io/distroless/static-debian12:nonroot@sha256:627d6c5a23ad24e6bdff827f16c7b60e0289029b0c79e9f7ccd54ae3279fb45f
15+
ARG TARGETOS
16+
ARG TARGETARCH
17+
ARG COMPONENT
18+
WORKDIR /
19+
COPY bin/$COMPONENT.$TARGETOS-$TARGETARCH /<component>
20+
# Copy ocm binary from downloader stage (adjust path if needed)
21+
COPY --from=downloader /tmp/ocm /usr/local/bin/ocm
22+
USER 65532:65532
23+
24+
# docker doesn't substitue args in ENTRYPOINT, so we replace this during the build script
25+
ENTRYPOINT ["/<component>"]

Taskfile.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ includes:
1414
REPO_URL: 'https://github.com/openmcp-project/bootstrapper'
1515
GENERATE_DOCS_INDEX: "true"
1616
CHART_COMPONENTS: "[]"
17+
DOCKERFILE: '{{.ROOT_DIR}}/Dockerfile'

renovate.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,17 @@
3636
"minimumReleaseAge": "0 days",
3737
"enabled": true
3838
}
39+
],
40+
"customManagers": [
41+
{
42+
"description": "All component dependencies and their versions used in the Dockerfile.",
43+
"customType": "regex",
44+
"managerFilePatterns": [
45+
"/Dockerfile/"
46+
],
47+
"matchStrings": [
48+
"# renovate: datasource=(?<datasource>[a-z-.]+?) depName=(?<depName>[^\\s]+?)(?: (lookupName|packageName)=(?<packageName>[^\\s]+?))?(?: versioning=(?<versioning>[^\\s]+?))?(?: extractVersion=(?<extractVersion>[^\\s]+?))?(?: registryUrl=(?<registryUrl>[^\\s]+?))?\\s.+?(_version|_VERSION)=\"?(?<currentValue>.+?)\"?\\s"
49+
]
50+
}
3951
]
4052
}

0 commit comments

Comments
 (0)