diff --git a/Others/fastjson/2.0.60/24.03-lts-sp2/Dockerfile b/Others/fastjson/2.0.60/24.03-lts-sp2/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..6f6bde81fffe10e3a7aaf91f1c468164d70d859d --- /dev/null +++ b/Others/fastjson/2.0.60/24.03-lts-sp2/Dockerfile @@ -0,0 +1,27 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp2 +FROM ${BASE} as BUILDER +ARG VERSION=2.0.60 + +RUN dnf install -y java-17-openjdk java-17-openjdk-devel gettext wget \ + && 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 + +ENV LANG="C.UTF-8" + +WORKDIR /home/fastjson +COPY Fastjson2Demo.java src/main/java/com/example/Fastjson2Demo.java +COPY pom.xml.template pom.xml.template + +ENV FAST_JSON_VERSION=${VERSION} + +RUN envsubst < pom.xml.template > pom.xml \ + && mvn clean compile -Dfile.encoding=UTF-8 + +CMD mvn exec:java -Dexec.mainClass="com.example.Fastjson2Demo" \ No newline at end of file diff --git a/Others/fastjson/2.0.60/24.03-lts-sp2/Fastjson2Demo.java b/Others/fastjson/2.0.60/24.03-lts-sp2/Fastjson2Demo.java new file mode 100644 index 0000000000000000000000000000000000000000..374a639cbafa9d06874476ca082df45c48029fad --- /dev/null +++ b/Others/fastjson/2.0.60/24.03-lts-sp2/Fastjson2Demo.java @@ -0,0 +1,25 @@ +package com.example; + +import com.alibaba.fastjson2.JSON; + +public class Fastjson2Demo { + static class User { + public String name; + public int age; + + public User() {} + public User(String name, int age) { + this.name = name; + this.age = age; + } + } + + public static void main(String[] args) { + User user = new User("张三", 25); + String jsonString = JSON.toJSONString(user); + System.out.println("序列化结果:" + jsonString); + + User parsed = JSON.parseObject(jsonString, User.class); + System.out.println("反序列化结果:" + parsed.name + ", " + parsed.age); + } +} diff --git a/Others/fastjson/2.0.60/24.03-lts-sp2/pom.xml.template b/Others/fastjson/2.0.60/24.03-lts-sp2/pom.xml.template new file mode 100644 index 0000000000000000000000000000000000000000..969fbd9c89fa0b92312d41772a3c7af2d8d10f3f --- /dev/null +++ b/Others/fastjson/2.0.60/24.03-lts-sp2/pom.xml.template @@ -0,0 +1,49 @@ + + + 4.0.0 + + com.example + fastjson2-demo + 1.0-SNAPSHOT + + + UTF-8 + 17 + 17 + + + + + com.alibaba.fastjson2 + fastjson2 + ${FAST_JSON_VERSION} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.0 + + com.example.Fastjson2Demo + + + + + + diff --git a/Others/fastjson/README.md b/Others/fastjson/README.md index e2ba7eef8f67de5bb98f079d3bfbe4983199c37e..b4ce8286ca7774643e8066d6ea1db2e0132a3085 100644 --- a/Others/fastjson/README.md +++ b/Others/fastjson/README.md @@ -16,6 +16,7 @@ The tag of each `fastjson` docker image is consist of the version of `fastjson` | Tag | Currently | Architectures | |-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|---------------| +|[2.0.60-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/fastjson/2.0.60/24.03-lts-sp2/Dockerfile) | fastjson 2.0.60 on openEuler 24.03-LTS-SP2 | amd64, arm64 | | [2.0.57-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/fastjson/2.0.57/24.03-lts-sp1/Dockerfile) | FASTJSON2 2.0.57 on openEuler 24.03-LTS-SP1 | amd64, arm64 | | [2.0.58-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/fastjson/2.0.58/24.03-lts-sp2/Dockerfile) | FASTJSON2 2.0.58 on openEuler 24.03-LTS-SP2 | amd64, arm64 | diff --git a/Others/fastjson/doc/image-info.yml b/Others/fastjson/doc/image-info.yml index 075c559f88379bdd016cc6065a1ba7d1d1bb6f6e..adf5d2ad56606f82239f1eab386560ccc68b0650 100644 --- a/Others/fastjson/doc/image-info.yml +++ b/Others/fastjson/doc/image-info.yml @@ -11,6 +11,7 @@ tags: | | Tag | Currently | Architectures | |-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------|---------------| + |[2.0.60-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/fastjson/2.0.60/24.03-lts-sp2/Dockerfile) | fastjson 2.0.60 on openEuler 24.03-LTS-SP2 | amd64, arm64 | | [2.0.57-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/fastjson/2.0.57/24.03-lts-sp1/Dockerfile) | FASTJSON2 2.0.57 on openEuler 24.03-LTS-SP1 | amd64, arm64 | | [2.0.58-oe2403sp2](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/fastjson/2.0.58/24.03-lts-sp2/Dockerfile) | FASTJSON2 2.0.58 on openEuler 24.03-LTS-SP2 | amd64, arm64 | diff --git a/Others/fastjson/meta.yml b/Others/fastjson/meta.yml index 79e407d9248a0e807ab7756ed5b169e7b425d3b9..8ab7c190e789b3d473b8f20ea9a10001a3caf1ce 100644 --- a/Others/fastjson/meta.yml +++ b/Others/fastjson/meta.yml @@ -2,3 +2,6 @@ path: 2.0.57/24.03-lts-sp1/Dockerfile 2.0.58-oe2403sp2: path: 2.0.58/24.03-lts-sp2/Dockerfile + +2.0.60-oe2403sp2: + path: 2.0.60/24.03-lts-sp2/Dockerfile \ No newline at end of file