diff --git a/Others/netty/4.2.1/24.03-lts-sp1/Dockerfile b/Others/netty/4.2.1/24.03-lts-sp1/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..f11f344062ab001abe8f0c7aaeb66e91ab81854b --- /dev/null +++ b/Others/netty/4.2.1/24.03-lts-sp1/Dockerfile @@ -0,0 +1,36 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp1 +FROM ${BASE} as BUILDER +ARG TARGETARCH +ARG BUILDARCH +ARG VERSION=4.2.1 +ARG JDK_VERSION=17.0.12 + +RUN dnf update -y \ + && dnf install -y wget maven gettext \ + && dnf clean all \ + && rm -rf /var/cache/dnf + +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + BUILDARCH="x64"; \ + elif [ "$TARGETARCH" = "arm64" ]; then \ + BUILDARCH="aarch64"; \ + fi \ + && cd / \ + && wget https://download.oracle.com/java/17/archive/jdk-${JDK_VERSION}_linux-${BUILDARCH}_bin.tar.gz \ + && tar -zxvf jdk-${JDK_VERSION}_linux-${BUILDARCH}_bin.tar.gz \ + && rm -f jdk-${JDK_VERSION}_linux-${BUILDARCH}_bin.tar.gz + +ENV JAVA_HOME=/jdk-17.0.12 +ENV PATH=/jdk-17.0.12/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}.Final + +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.1/24.03-lts-sp1/NettyDemo.java b/Others/netty/4.2.1/24.03-lts-sp1/NettyDemo.java new file mode 100644 index 0000000000000000000000000000000000000000..fca4dfd834b2502b5062fa5f0c33669d1d5a5991 --- /dev/null +++ b/Others/netty/4.2.1/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.1/24.03-lts-sp1/pom.xml.template b/Others/netty/4.2.1/24.03-lts-sp1/pom.xml.template new file mode 100644 index 0000000000000000000000000000000000000000..f34be9719b166e07048c841d9a118c2d93a27ab8 --- /dev/null +++ b/Others/netty/4.2.1/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/meta.yml b/Others/netty/meta.yml new file mode 100644 index 0000000000000000000000000000000000000000..14e6a7d8f73c095c9c8010e9a6fce464603ee505 --- /dev/null +++ b/Others/netty/meta.yml @@ -0,0 +1,3 @@ +4.2.1-oe2403sp1: + path: 4.2.1/24.03-lts-sp1/Dockerfile + diff --git a/Others/npm/11.4.0/24.03-lts-sp1/Dockerfile b/Others/npm/11.4.0/24.03-lts-sp1/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d252240adc781c3690589d8fbd698351c0492d08 --- /dev/null +++ b/Others/npm/11.4.0/24.03-lts-sp1/Dockerfile @@ -0,0 +1,12 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp1 +FROM ${BASE} as BUILDER +ARG VERSION=11.4.0 +ARG NVM_VERSION=0.40.3 +ARG NODE_VERSION=22 + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash \ + && source "$HOME/.nvm/nvm.sh" \ + && nvm install ${NODE_VERSION} \ + && npm install -g npm@${VERSION} + +CMD ["npm", "-v"] diff --git a/Others/npm/meta.yml b/Others/npm/meta.yml new file mode 100644 index 0000000000000000000000000000000000000000..c05777bf0b49b512759c6d24b06515b798151fdb --- /dev/null +++ b/Others/npm/meta.yml @@ -0,0 +1,3 @@ +11.4.0-oe2403sp1: + path: 11.4.0/24.03-lts-sp1/Dockerfile +