From 6ff40fca25ee14c06d4b75285c39681ca5c6bf2f Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Wed, 18 Jun 2025 16:01:13 +0800 Subject: [PATCH] add distroless-base-nonroot --- .../2.38/24.03-lts/Dockerfile | 26 +++++++++++++++++++ Distroless/distroless-base-nonroot/meta.yml | 3 +++ Distroless/image-list.yml | 1 + 3 files changed, 30 insertions(+) create mode 100644 Distroless/distroless-base-nonroot/2.38/24.03-lts/Dockerfile create mode 100644 Distroless/distroless-base-nonroot/meta.yml diff --git a/Distroless/distroless-base-nonroot/2.38/24.03-lts/Dockerfile b/Distroless/distroless-base-nonroot/2.38/24.03-lts/Dockerfile new file mode 100644 index 00000000..8c395293 --- /dev/null +++ b/Distroless/distroless-base-nonroot/2.38/24.03-lts/Dockerfile @@ -0,0 +1,26 @@ +ARG BASE=openeuler/openeuler:24.03-lts +FROM ${BASE} as builder + +WORKDIR /tmp + +RUN echo "root:x:0:0:root:/root:/sbin/nologin" > passwd && \ + echo "nobody:x:65534:65534:nobody:/nonexistent:/sbin/nologin" >> passwd && \ + echo "nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin" >> passwd + +RUN echo "root:x:0:" > group && \ + echo "nobody:x:65534:" >> group && \ + echo "tty:x:5:" >> group && \ + echo "staff:x:50:" >> group && \ + echo "nonroot:x:65532:" >> group + +RUN mkdir -p /home/nonroot && \ + chmod 700 /home/nonroot + +FROM openeuler/distroless-base:2.38-oe2403lts + +COPY --from=builder /tmp/passwd /etc/passwd +COPY --from=builder /tmp/group /etc/group +COPY --from=builder --chown=nonroot:nonroot /home/nonroot /home/nonroot + +USER nonroot +WORKDIR /home/nonroot \ No newline at end of file diff --git a/Distroless/distroless-base-nonroot/meta.yml b/Distroless/distroless-base-nonroot/meta.yml new file mode 100644 index 00000000..bca2d502 --- /dev/null +++ b/Distroless/distroless-base-nonroot/meta.yml @@ -0,0 +1,3 @@ + +2.38-oe2403lts: + path: 2.38/24.03-lts/Distrofile \ No newline at end of file diff --git a/Distroless/image-list.yml b/Distroless/image-list.yml index acb89c8b..436e28e7 100644 --- a/Distroless/image-list.yml +++ b/Distroless/image-list.yml @@ -8,3 +8,4 @@ images: distroless-php: distroless-php distroless-pip: distroless-pip distroless-ruby: distroless-ruby + distroless-base-nonroot: distroless-base-nonroot -- Gitee