From 7ede5fb8be67a1750e025d9b1cced44f7e46f888 Mon Sep 17 00:00:00 2001 From: openeuler_bot Date: Fri, 5 Sep 2025 00:09:45 +0000 Subject: [PATCH] 24.03-lts-sp1 update netty to 4.2.5 --- Others/netty/4.2.5/24.03-lts-sp1/Dockerfile | 27 +++++++++ .../netty/4.2.5/24.03-lts-sp1/NettyDemo.java | 60 +++++++++++++++++++ .../4.2.5/24.03-lts-sp1/pom.xml.template | 40 +++++++++++++ Others/netty/README.md | 3 +- Others/netty/doc/image-info.yml | 1 + Others/netty/meta.yml | 3 + 6 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 Others/netty/4.2.5/24.03-lts-sp1/Dockerfile create mode 100644 Others/netty/4.2.5/24.03-lts-sp1/NettyDemo.java create mode 100644 Others/netty/4.2.5/24.03-lts-sp1/pom.xml.template diff --git a/Others/netty/4.2.5/24.03-lts-sp1/Dockerfile b/Others/netty/4.2.5/24.03-lts-sp1/Dockerfile new file mode 100644 index 00000000..c19fa017 --- /dev/null +++ b/Others/netty/4.2.5/24.03-lts-sp1/Dockerfile @@ -0,0 +1,27 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp1 +FROM ${BASE} +ARG VERSION=4.2.5.Final + +RUN dnf update -y \ + && dnf install -y wget java-17-openjdk java-17-openjdk-devel gettext \ + && dnf clean all \ + && rm -rf /var/cache/dnf/* + +ARG MAVEN_VERSION=3.9.11 +RUN wget https://dlcdn.apache.org/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ + && mkdir -p /usr/local/maven \ + && tar -zxvf apache-maven-3.9.11-bin.tar.gz -C /usr/local/maven --strip-components=1 + +ENV PATH=/usr/local/maven/bin:$PATH + +WORKDIR /opt/netty + +COPY NettyDemo.java src/main/java/demo/NettyDemo.java +COPY pom.xml.template pom.xml.template + +ENV NETTY_VERSION=${VERSION} + +RUN envsubst < pom.xml.template > pom.xml \ + && mvn clean package -Dfile.encoding=UTF-8 + +CMD ["java", "-cp", "target/netty-demo-1.0-SNAPSHOT.jar", "demo.NettyDemo"] diff --git a/Others/netty/4.2.5/24.03-lts-sp1/NettyDemo.java b/Others/netty/4.2.5/24.03-lts-sp1/NettyDemo.java new file mode 100644 index 00000000..fca4dfd8 --- /dev/null +++ b/Others/netty/4.2.5/24.03-lts-sp1/NettyDemo.java @@ -0,0 +1,60 @@ +package demo; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.*; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; + +public class NettyDemo { + private final int port; + + public NettyDemo(int port) { + this.port = port; + } + + public void start() throws InterruptedException { + EventLoopGroup bossGroup = new NioEventLoopGroup(1); + EventLoopGroup workerGroup = new NioEventLoopGroup(); + try { + ServerBootstrap b = new ServerBootstrap(); + b.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .childHandler(new ChannelInitializer() { + @Override + public void initChannel(SocketChannel ch) { + ch.pipeline().addLast(new NettyHandler()); + } + }); + + ChannelFuture f = b.bind(port).sync(); + System.out.println("Echo server started on port " + port); + f.channel().closeFuture().sync(); + } finally { + bossGroup.shutdownGracefully(); + workerGroup.shutdownGracefully(); + } + } + + public static void main(String[] args) throws InterruptedException { + new NettyDemo(8080).start(); + } +} + +class NettyHandler extends ChannelInboundHandlerAdapter { + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) { + ctx.write(msg); + } + + @Override + public void channelReadComplete(ChannelHandlerContext ctx) { + ctx.flush(); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + cause.printStackTrace(); + ctx.close(); + } +} diff --git a/Others/netty/4.2.5/24.03-lts-sp1/pom.xml.template b/Others/netty/4.2.5/24.03-lts-sp1/pom.xml.template new file mode 100644 index 00000000..f34be971 --- /dev/null +++ b/Others/netty/4.2.5/24.03-lts-sp1/pom.xml.template @@ -0,0 +1,40 @@ + + 4.0.0 + + org.example + netty-demo + 1.0-SNAPSHOT + + + UTF-8 + 17 + 17 + + + + + io.netty + netty-all + ${NETTY_VERSION} + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + shade + + + + + + + diff --git a/Others/netty/README.md b/Others/netty/README.md index 001431e5..18d0b9ec 100644 --- a/Others/netty/README.md +++ b/Others/netty/README.md @@ -18,6 +18,7 @@ The tag of each `netty` docker image is consist of the version of `netty` and th | Tag | Currently | Architectures | |--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|---------------| +|[4.2.5-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/netty/4.2.5/24.03-lts-sp1/Dockerfile) | netty 4.2.5 on openEuler 24.03-LTS-SP1 | amd64, arm64 | | [4.2.1-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/netty/4.2.1/24.03-lts-sp1/Dockerfile) | Netty 4.2.1 on openEuler 24.03-LTS-SP1 | amd64, arm64 | | [4.2.4-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/netty/4.2.4/24.03-lts-sp2/Dockerfile) | Netty 4.2.4 on openEuler 24.03-LTS-SP2 | amd64, arm64 | @@ -116,4 +117,4 @@ In this usage, users can select the corresponding `{Tag}` based on their require Any input will be echoed back by the server. # 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). +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/Others/netty/doc/image-info.yml b/Others/netty/doc/image-info.yml index ea05344a..d0140446 100644 --- a/Others/netty/doc/image-info.yml +++ b/Others/netty/doc/image-info.yml @@ -11,6 +11,7 @@ tags: | | Tag | Currently | Architectures | |--------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|---------------| + |[4.2.5-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/netty/4.2.5/24.03-lts-sp1/Dockerfile) | netty 4.2.5 on openEuler 24.03-LTS-SP1 | amd64, arm64 | | [4.2.1-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/netty/4.2.1/24.03-lts-sp1/Dockerfile) | Netty 4.2.1 on openEuler 24.03-LTS-SP1 | amd64, arm64 | | [4.2.4-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/netty/4.2.4/24.03-lts-sp2/Dockerfile) | Netty 4.2.4 on openEuler 24.03-LTS-SP2 | amd64, arm64 | diff --git a/Others/netty/meta.yml b/Others/netty/meta.yml index 154fdf63..a2bd90d1 100644 --- a/Others/netty/meta.yml +++ b/Others/netty/meta.yml @@ -2,3 +2,6 @@ path: 4.2.1/24.03-lts-sp1/Dockerfile 4.2.4-oe2403sp2: path: 4.2.4/24.03-lts-sp2/Dockerfile + +4.2.5-oe2403sp1: + path: 4.2.5/24.03-lts-sp1/Dockerfile \ No newline at end of file -- Gitee