diff --git a/Others/image-list.yml b/Others/image-list.yml index bdb3373a88ed6bdc64b5008b59bf02e46c0942af..f33a57f04d8e3ca8da42e92e3c23ae522d595a1f 100644 --- a/Others/image-list.yml +++ b/Others/image-list.yml @@ -27,3 +27,4 @@ images: swagger-ui: swagger-ui react: react next: next + spring-boot: spring-boot diff --git a/Others/spring-boot/3.4.4/24.03-lts-sp1/Application.java b/Others/spring-boot/3.4.4/24.03-lts-sp1/Application.java new file mode 100644 index 0000000000000000000000000000000000000000..7674a4b76ee805a957275dbc8ef84c47b8209018 --- /dev/null +++ b/Others/spring-boot/3.4.4/24.03-lts-sp1/Application.java @@ -0,0 +1,19 @@ +package com.spring.boot; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.*; + +@SpringBootApplication +@RestController +public class Application { + + @RequestMapping("/") + public String home() { + return "Hello World!"; + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/Others/spring-boot/3.4.4/24.03-lts-sp1/Dockerfile b/Others/spring-boot/3.4.4/24.03-lts-sp1/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8370a934880af92dc4c040ab18939c8e4f30a2e6 --- /dev/null +++ b/Others/spring-boot/3.4.4/24.03-lts-sp1/Dockerfile @@ -0,0 +1,68 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp1 +FROM ${BASE} as BUILDER + +ARG TARGETARCH +ARG BUILDARCH +ARG VERSION=3.4.4 +ARG JDK_VERSION=17.0.15_6 +ARG MAVEN_VERSION=3.8.1 + +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + BUILDARCH="x64"; \ + elif [ "$TARGETARCH" = "arm64" ]; then \ + BUILDARCH="aarch64"; \ + fi \ + && cd / \ + && yum install -y wget \ + && wget https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jdk/${BUILDARCH}/linux/OpenJDK17U-jdk_${BUILDARCH}_linux_hotspot_${JDK_VERSION}.tar.gz \ + && tar -zxvf OpenJDK17U-jdk_${BUILDARCH}_linux_hotspot_${JDK_VERSION}.tar.gz \ + && wget https://repo.huaweicloud.com/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ + && tar -zxvf apache-maven-${MAVEN_VERSION}-bin.tar.gz + +ENV JAVA_HOME=/jdk-17.0.15+6 +ENV PATH=${JAVA_HOME}/bin:$PATH + +ENV MAVEN_HOME=/apache-maven-${MAVEN_VERSION} +ENV PATH=${MAVEN_HOME}/bin:$PATH + +COPY Application.java /spring-boot/src/main/java/com/spring/boot/Application.java +COPY pom.xml.template /spring-boot/pom.xml.template + +ENV SPRING_BOOT_VERSION=${VERSION} + +RUN dnf install -y gettext \ + && cd /spring-boot \ + && envsubst < pom.xml.template > pom.xml \ + && mvn clean install package -Dmaven.test.skip + + +FROM ${BASE} +ARG TARGETARCH +ARG BUILDARCH +ARG JRE_VERSION=17.0.15_6 + +RUN yum update -y \ + && yum install -y wget + +ENV WORKSPACE=/home/spring-boot + +WORKDIR ${WORKSPACE} + +COPY --chown=spring-boot --from=Builder /spring-boot/target ${WORKSPACE}/target + +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + BUILDARCH="x64"; \ + elif [ "$TARGETARCH" = "arm64" ]; then \ + BUILDARCH="aarch64"; \ + fi \ + && wget https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jre/${BUILDARCH}/linux/OpenJDK17U-jre_${BUILDARCH}_linux_hotspot_${JRE_VERSION}.tar.gz \ + && tar -zxvf OpenJDK17U-jre_${BUILDARCH}_linux_hotspot_${JRE_VERSION}.tar.gz \ + && rm OpenJDK17U-jre_${BUILDARCH}_linux_hotspot_${JRE_VERSION}.tar.gz + +ENV JAVA_HOME=${WORKSPACE}/jdk-17.0.15+6-jre +ENV PATH=${JAVA_HOME}/bin:$PATH +ENV LANG="C.UTF-8" + +EXPOSE 8080 + +CMD java -jar ${WORKSPACE}/target/demo-1.0.jar \ No newline at end of file diff --git a/Others/spring-boot/3.4.4/24.03-lts-sp1/pom.xml.template b/Others/spring-boot/3.4.4/24.03-lts-sp1/pom.xml.template new file mode 100644 index 0000000000000000000000000000000000000000..f32839de9b84c6fa6bfaf577cf1257717a52b523 --- /dev/null +++ b/Others/spring-boot/3.4.4/24.03-lts-sp1/pom.xml.template @@ -0,0 +1,53 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + ${SPRING_BOOT_VERSION} + + + + com.spring.boot + demo + 1.0 + + + + org.springframework.boot + spring-boot-starter-web + + + + + + + org.springframework.boot + spring-boot-maven-plugin + 3.4.4 + + + + repackage + + + + + com.spring.boot.Application + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 17 + 17 + + + + + \ No newline at end of file diff --git a/Others/spring-boot/meta.yml b/Others/spring-boot/meta.yml new file mode 100644 index 0000000000000000000000000000000000000000..8f5cf5cd1ec7db91dea223e2469c1c21e5bcbfbb --- /dev/null +++ b/Others/spring-boot/meta.yml @@ -0,0 +1,2 @@ +3.4.4-oe2403sp1: + path: 3.4.4/24.03-lts-sp1/Dockerfile