From 024b1ee5e3fa98494f90f6d84237ddc88f078813 Mon Sep 17 00:00:00 2001 From: GuangJie1 Date: Thu, 14 Aug 2025 15:17:14 +0800 Subject: [PATCH] add distroless readme --- Distroless/distroless-jre/README.md | 48 +++++++++++++++++++ .../distroless-jre/example/Dockerfile.example | 12 +++++ Distroless/distroless-jre/example/Hello.java | 5 ++ Distroless/distroless-nodejs/README.md | 34 +++++++++++++ .../example/Dockerfile.example | 3 ++ Distroless/distroless-nodejs/example/hello.js | 1 + 6 files changed, 103 insertions(+) create mode 100644 Distroless/distroless-jre/README.md create mode 100644 Distroless/distroless-jre/example/Dockerfile.example create mode 100644 Distroless/distroless-jre/example/Hello.java create mode 100644 Distroless/distroless-nodejs/README.md create mode 100644 Distroless/distroless-nodejs/example/Dockerfile.example create mode 100644 Distroless/distroless-nodejs/example/hello.js diff --git a/Distroless/distroless-jre/README.md b/Distroless/distroless-jre/README.md new file mode 100644 index 00000000..be15fb37 --- /dev/null +++ b/Distroless/distroless-jre/README.md @@ -0,0 +1,48 @@ +# Quick reference + +- The official distroless-jre docker image. + +- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). + +- Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). + +# distroless-jre | openEuler +The Distroless JRE image is a minimal Java runtime environment designed to run Java applications in a secure and lightweight containerized environment. +It includes only what is necessary for executing Java programs and does not contain development tools such as `javac`. + +Contents: +* Java Virtual Machine(JVM) +* Core Java Class Libraries +* Minimal System Dependencies + +# Supported tags and respective Dockerfile links +The tag of each `distroless-jre` docker image is consist of the version of `OpenJDK` and version of openEuler. The details are as follows + +| Tag | Currently | Architectures | +|-------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|---------------| +| [21.0.2.12-oe2403lts](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Distroless/distroless-jre/21.0.2.12/24.03-lts/Distrofile) | OpenJDK 21.0.2.12 on openEuler 24.03-LTS | amd64, arm64 | + +# Usage +1. Starts from the full openEuler image with a JDK installed and compiles the java source file into bytecode. +2. Copies the compiled `.class` file from the build stage and ets `JAVA_HOME` and adds the JVM `bin` directory to `PATH` for easy execution. +3. For [example](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Distroless/distroless-jre/example) + +``` +FROM openeuler/openeuler:latest AS build-env +COPY . /app +WORKDIR /app +RUN yum install -y java-21-openjdk-devel +RUN javac Hello.java + +FROM openeuler/distroless-jre:21.0.2.12-oe2403lts +COPY --from=build-env /app /app +WORKDIR /app +ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-21.0.2.12-2.oe2403.aarch64 +ENV PATH=$JAVA_HOME/bin:$PATH +CMD ["java", "Hello"] +``` +# Run Applications as a Non-Root User +For implementation details, refer to the [distroless-base-nonroot documentation](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Distroless/distroless-base-nonroot/README.md). + +# Question and answering +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Distroless/distroless-jre/example/Dockerfile.example b/Distroless/distroless-jre/example/Dockerfile.example new file mode 100644 index 00000000..54a0f197 --- /dev/null +++ b/Distroless/distroless-jre/example/Dockerfile.example @@ -0,0 +1,12 @@ +FROM openeuler/openeuler:latest AS build-env +COPY . /app +WORKDIR /app +RUN yum install -y java-21-openjdk-devel +RUN javac Hello.java + +FROM openeuler/distroless-jre:21.0.2.12-oe2403lts +COPY --from=build-env /app /app +WORKDIR /app +ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-21.0.2.12-2.oe2403.aarch64 +ENV PATH=$JAVA_HOME/bin:$PATH +CMD ["java", "Hello"] \ No newline at end of file diff --git a/Distroless/distroless-jre/example/Hello.java b/Distroless/distroless-jre/example/Hello.java new file mode 100644 index 00000000..2d946bbf --- /dev/null +++ b/Distroless/distroless-jre/example/Hello.java @@ -0,0 +1,5 @@ +public class Hello { + public static void main(String[] args) { + System.out.println("Hello from distroless jre!"); + } +} \ No newline at end of file diff --git a/Distroless/distroless-nodejs/README.md b/Distroless/distroless-nodejs/README.md new file mode 100644 index 00000000..bebcf7fd --- /dev/null +++ b/Distroless/distroless-nodejs/README.md @@ -0,0 +1,34 @@ +# Quick reference + +- The official distroless-nodejs docker image. + +- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). + +- Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). + +# distroless-nodejs | openEuler +This image contains a minimal Linux, that only contains the Node.js runtime. +- It contains the Node.js executable and standard libraries(`libnode.so` and the built-in modules in `node_muodules`) +- It does not include npm or any other package management or shell tools. + +# Supported tags and respective Dockerfile links +The tag of each `distroless-nodejs` docker image is consist of the version of `Node.js` and version of openEuler. The details are as follows + +| Tag | Currently | Architectures | +|------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|---------------| +| [20.18.2-oe2403lts](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Distroless/distroless-nodejs/20.18.2/24.03-lts/Distrofile) | Node.js 20.18.2 on openEuler 24.03-LTS | amd64, arm64 | + +# Usage +The container automatically uses the built-in Node.js runtime to execute the file, so you don't need to call node explicitly. For [example](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Distroless/distroless-nodejs/example) + +``` +FROM openeuler/distroless-nodejs:20.18.2-oe2403lts +COPY hello.js /hello.js +CMD ["/hello.js"] +``` + +# Run Applications as a Non-Root User +For implementation details, refer to the [distroless-base-nonroot documentation](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Distroless/distroless-base-nonroot/README.md). + +# Question and answering +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Distroless/distroless-nodejs/example/Dockerfile.example b/Distroless/distroless-nodejs/example/Dockerfile.example new file mode 100644 index 00000000..5fe3d919 --- /dev/null +++ b/Distroless/distroless-nodejs/example/Dockerfile.example @@ -0,0 +1,3 @@ +FROM openeuler/distroless-nodejs:20.18.2-oe2403lts +COPY hello.js /hello.js +CMD ["/hello.js"] \ No newline at end of file diff --git a/Distroless/distroless-nodejs/example/hello.js b/Distroless/distroless-nodejs/example/hello.js new file mode 100644 index 00000000..73a07987 --- /dev/null +++ b/Distroless/distroless-nodejs/example/hello.js @@ -0,0 +1 @@ +console.log("Hello from distroless nodejs!") \ No newline at end of file -- Gitee