From 25ac2ccaaf7bcac18c7015341e00dae9a75ff2b4 Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Tue, 16 Jul 2024 15:13:55 +0300 Subject: [PATCH] feat: create both rootless and rootfull images (#22) * added rootless dockerfile --------- Co-authored-by: mikhail-klimko --- Dockerfile | 38 +++++++++----------------------------- Dockerfile.rootless | 27 +++++++++++++++++++++++++++ service.yaml | 2 +- 3 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 Dockerfile.rootless diff --git a/Dockerfile b/Dockerfile index 25b1fac..ea3100b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,15 @@ -ARG ARCH=amd64 +FROM alpine:3.20.1 -FROM prom/node-exporter:v1.6.1 AS node-exporter +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/ -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 +RUN apk add --update bash coreutils 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..d400705 --- /dev/null +++ b/Dockerfile.rootless @@ -0,0 +1,27 @@ +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 +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