Skip to content

Commit af428f4

Browse files
committed
Update Dockerfile to use commodore tool to install external tools
We update the Dockerfile to use `commodore tool install` to install the required external tools. Note that we use individual calls for each tool so we can still have well-defined external tool versions in the container image. To standardize the external tool management in the container image, we also introduce an explicit Helm 3 version for the container image. Since we don't need Helm 2 anymore, we don't install the `helm2` binary in the container image anymore. Finally, we also remove `tools/install-jb.sh` which isn't required anymore and adjust the container image test to use the new `commodore version` command.
1 parent 4dc943d commit af428f4

4 files changed

Lines changed: 21 additions & 47 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,4 @@ jobs:
163163
run: make docker
164164
- name: Run image
165165
run: |
166-
docker run docker.io/projectsyn/commodore:test || exit_code=$?
167-
if [ "$exit_code" -ne 2 ]; then
168-
echo "Unexpected exit code $exit_code, expected 2"
169-
exit $exit_code
170-
fi
166+
docker run docker.io/projectsyn/commodore:test version

Dockerfile

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ARG POETRY_VERSION=1.8.5
1515
RUN apt-get update && apt-get install -y --no-install-recommends \
1616
build-essential \
1717
curl \
18+
git \
1819
libffi-dev \
1920
&& rm -rf /var/lib/apt/lists/* \
2021
&& curl -sSL https://install.python-poetry.org | python - --version ${POETRY_VERSION} \
@@ -37,22 +38,13 @@ RUN sed -i "s/^__git_version__.*$/__git_version__ = '${GITVERSION}'/" commodore/
3738

3839
RUN pip install ./dist/syn_commodore-*-py3-none-any.whl
3940

40-
RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 \
41-
&& chmod 700 get_helm.sh \
42-
&& ./get_helm.sh \
43-
&& mv /usr/local/bin/helm /usr/local/bin/helm3 \
44-
&& curl -LO https://git.io/get_helm.sh \
45-
&& chmod 700 get_helm.sh \
46-
&& ./get_helm.sh \
47-
&& mv /usr/local/bin/helm /usr/local/bin/helm2
48-
4941
ARG KUSTOMIZE_VERSION=5.7.0
5042
ARG JSONNET_BUNDLER_VERSION=v0.6.3
43+
ARG HELM_VERSION=v3.18.4
5144

52-
RUN ./tools/install-jb.sh ${JSONNET_BUNDLER_VERSION} \
53-
&& curl -fsSLO "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" \
54-
&& chmod +x install_kustomize.sh \
55-
&& ./install_kustomize.sh ${KUSTOMIZE_VERSION} /usr/local/bin
45+
RUN commodore tool install helm --version ${HELM_VERSION} \
46+
&& commodore tool install kustomize --version ${KUSTOMIZE_VERSION} \
47+
&& commodore tool install jb --version ${JSONNET_BUNDLER_VERSION}
5648

5749
FROM base AS runtime
5850

@@ -73,12 +65,17 @@ COPY --from=builder \
7365
COPY --from=builder \
7466
/usr/local/bin/kapitan* \
7567
/usr/local/bin/commodore* \
76-
/usr/local/bin/helm* \
77-
/usr/local/bin/jb \
78-
/usr/local/bin/kustomize \
7968
/usr/local/bin/
8069

81-
RUN ln -s /usr/local/bin/helm3 /usr/local/bin/helm
70+
COPY --from=builder \
71+
/app/.cache/commodore/tools/ \
72+
/app/.cache/commodore/tools/
73+
74+
RUN ln -s \
75+
/app/.cache/commodore/tools/helm \
76+
/app/.cache/commodore/tools/jb \
77+
/app/.cache/commodore/tools/kustomize \
78+
/usr/local/bin/
8279

8380
COPY ./tools/entrypoint.sh /usr/local/bin/
8481

renovate.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
"matchStrings": ["ARG JSONNET_BUNDLER_VERSION=(?<currentValue>.*?)\\n"],
4848
"datasourceTemplate": "github-releases",
4949
"depNameTemplate": "projectsyn/jsonnet-bundler"
50+
},
51+
{
52+
"fileMatch": ["^Dockerfile$"],
53+
"matchStrings": ["ARG HELM_VERSION=(?<currentValue>.*?)\\n"],
54+
"datasourceTemplate": "github-releases",
55+
"depNameTemplate": "helm/helm"
5056
}
5157
],
5258
"packageRules": [

tools/install-jb.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)