From 00faa4c94457fc6a87455995f5b0a7dd095f4a1b Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Thu, 4 Jul 2024 17:18:31 +0300 Subject: [PATCH 1/6] added rootless dockerfile --- Dockerfile | 38 ++++++++------------------------------ Dockerfile.rootless | 25 +++++++++++++++++++++++++ service.yaml | 2 +- 3 files changed, 34 insertions(+), 31 deletions(-) create mode 100644 Dockerfile.rootless diff --git a/Dockerfile b/Dockerfile index 25b1fac..e9d2f51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,13 @@ -ARG ARCH=amd64 +FROM alpine:3.20.1 -FROM prom/node-exporter:v1.6.1 AS node-exporter - -FROM alpine:3.16.7 - -COPY --from=node-exporter /bin/node_exporter /bin/ - -ENV KUBECTL_VERSION="v1.8.8" - -RUN apk add --update curl bash coreutils \ - && export ARCH=$([[ "$(uname -m)" == "aarch64" ]] && echo "arm64" || echo "amd64") \ - && curl -L https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl -o /usr/local/bin/kubectl \ - && chmod +x /usr/local/bin/kubectl - -# add user -RUN addgroup --gid 1000 dind-volume-utils && \ - adduser --uid 1000 --gecos "" --disabled-password \ - --ingroup dind-volume-utils \ - --home /home/dind-volume-utils \ - --shell /bin/bash dind-volume-utils +COPY --from=prom/node-exporter:v1.8.1 /bin/node_exporter /usr/local/bin/ +COPY --from=bitnami/kubectl:1.30.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ WORKDIR /home/dind-volume-utils -ADD bin ./bin -ADD monitor ./monitor -ADD dind-metrics ./dind-metrics -ADD local-volumes ./local-volumes - -RUN chown -R dind-volume-utils:dind-volume-utils /home/dind-volume-utils && \ - chmod 755 /home/dind-volume-utils - -USER dind-volume-utils:dind-volume-utils +COPY bin ./bin +COPY monitor ./monitor +COPY dind-metrics ./dind-metrics +COPY local-volumes ./local-volumes -CMD ["/bin/bash"] +CMD ["sh"] diff --git a/Dockerfile.rootless b/Dockerfile.rootless new file mode 100644 index 0000000..0a4533d --- /dev/null +++ b/Dockerfile.rootless @@ -0,0 +1,25 @@ +FROM alpine:3.20.1 + +COPY --from=prom/node-exporter:v1.8.1 /bin/node_exporter /usr/local/bin/ +COPY --from=bitnami/kubectl:1.30.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ + +WORKDIR /home/dind-volume-utils + +COPY bin ./bin +COPY monitor ./monitor +COPY dind-metrics ./dind-metrics +COPY local-volumes ./local-volumes + +# add user +RUN addgroup --gid 1000 dind-volume-utils && \ + adduser --uid 1000 --gecos "" --disabled-password \ + --ingroup dind-volume-utils \ + --home /home/dind-volume-utils \ + --shell /bin/bash dind-volume-utils + +RUN chown -R dind-volume-utils:dind-volume-utils /home/dind-volume-utils && \ + chmod 755 /home/dind-volume-utils + +USER dind-volume-utils:dind-volume-utils + +CMD ["sh"] diff --git a/service.yaml b/service.yaml index b7a1e43..b85a472 100644 --- a/service.yaml +++ b/service.yaml @@ -1 +1 @@ -version: 1.29.5 +version: 1.30.0 From c00fbfca8c5baad04eb8643531f74c96607581c8 Mon Sep 17 00:00:00 2001 From: mikhail-klimko Date: Mon, 15 Jul 2024 09:42:15 +0300 Subject: [PATCH 2/6] empty From 911fcb3632ebaba018599a607f0c636e505fabe1 Mon Sep 17 00:00:00 2001 From: mikhail-klimko Date: Mon, 15 Jul 2024 09:44:49 +0300 Subject: [PATCH 3/6] empty From 81a12824ed98fac9ff993348e183934dedcf7194 Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Mon, 15 Jul 2024 12:42:48 +0300 Subject: [PATCH 4/6] fixed workdir in rootfull version --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e9d2f51..8d5ec92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,6 @@ FROM alpine:3.20.1 COPY --from=prom/node-exporter:v1.8.1 /bin/node_exporter /usr/local/bin/ COPY --from=bitnami/kubectl:1.30.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ -WORKDIR /home/dind-volume-utils - COPY bin ./bin COPY monitor ./monitor COPY dind-metrics ./dind-metrics From 2c6bdac427a5ebb3262b66e220d4bfe4ef9a7181 Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Mon, 15 Jul 2024 14:29:24 +0300 Subject: [PATCH 5/6] added missing bash binary --- Dockerfile | 2 ++ Dockerfile.rootless | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8d5ec92..10ca147 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ FROM alpine:3.20.1 COPY --from=prom/node-exporter:v1.8.1 /bin/node_exporter /usr/local/bin/ COPY --from=bitnami/kubectl:1.30.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ +RUN apk add --update bash coreutils + COPY bin ./bin COPY monitor ./monitor COPY dind-metrics ./dind-metrics diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 0a4533d..d400705 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -3,6 +3,8 @@ FROM alpine:3.20.1 COPY --from=prom/node-exporter:v1.8.1 /bin/node_exporter /usr/local/bin/ COPY --from=bitnami/kubectl:1.30.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ +RUN apk add --update bash coreutils + WORKDIR /home/dind-volume-utils COPY bin ./bin From 166fa870426b1f04b2ef9a9f519c06c21e043fbf Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Mon, 15 Jul 2024 14:30:19 +0300 Subject: [PATCH 6/6] reset home directory --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 10ca147..ea3100b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ COPY --from=bitnami/kubectl:1.30.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/b RUN apk add --update bash coreutils +WORKDIR /home/dind-volume-utils + COPY bin ./bin COPY monitor ./monitor COPY dind-metrics ./dind-metrics