diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 4140568..8081566 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -11,14 +11,16 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - java-version: 1.8 + distribution: temurin + java-version: '21' + cache: maven + - name: Build with Maven - run: mvn -B package --file pom.xml + run: ./mvnw -B -ntp verify diff --git a/.github/workflows/portainer-deploy.yml b/.github/workflows/portainer-deploy.yml index 34df925..89c9f8d 100644 --- a/.github/workflows/portainer-deploy.yml +++ b/.github/workflows/portainer-deploy.yml @@ -27,14 +27,14 @@ jobs: uses: actions/setup-java@v4 with: distribution: temurin - java-version: '8' + java-version: '21' cache: maven - name: Make Maven wrapper executable run: chmod +x mvnw - name: Build application - run: ./mvnw -B package -DskipTests + run: ./mvnw -B -ntp package -DskipTests - name: Log in to GitHub Container Registry uses: docker/login-action@v3 diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000..c23a95a --- /dev/null +++ b/.mvn/jvm.config @@ -0,0 +1,15 @@ +--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED +--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED +--add-opens=java.base/java.lang=ALL-UNNAMED +--add-opens=java.base/java.lang.invoke=ALL-UNNAMED +--add-opens=java.base/java.lang.reflect=ALL-UNNAMED +--add-opens=java.base/java.io=ALL-UNNAMED +--add-opens=java.base/java.util=ALL-UNNAMED diff --git a/.mvn/toolchains.xml b/.mvn/toolchains.xml new file mode 100644 index 0000000..5ce8487 --- /dev/null +++ b/.mvn/toolchains.xml @@ -0,0 +1,12 @@ + + + + jdk + + 21 + + + ${env.JAVA_HOME} + + + diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index c954cec..4465bd9 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1 +1 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip +distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip diff --git a/Dockerfile b/Dockerfile index 6f68fe0..c36328f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,25 @@ -FROM eclipse-temurin:8-jdk-alpine +FROM maven:3.9.6-eclipse-temurin-21 as builder +WORKDIR /workspace +COPY .mvn ./.mvn +COPY pom.xml . +COPY src ./src +RUN mvn -B -e -DskipTests clean package + +FROM eclipse-temurin:21-jdk-alpine VOLUME /tmp -COPY target/botplatform-0.0.1-SNAPSHOT.jar app.jar +COPY --from=builder /workspace/target/botplatform-0.0.1-SNAPSHOT.jar /app.jar RUN apk update \ && apk add --no-cache ca-certificates fontconfig ttf-dejavu \ && update-ca-certificates \ && rm -rf /var/cache/apk/* -ENTRYPOINT ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] +ENTRYPOINT ["java", + "--add-opens=java.base/java.lang=ALL-UNNAMED", + "--add-opens=java.base/java.lang.invoke=ALL-UNNAMED", + "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED", + "--add-opens=java.base/java.io=ALL-UNNAMED", + "--add-opens=java.base/java.net=ALL-UNNAMED", + "--add-opens=java.base/java.util=ALL-UNNAMED", + "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", + "-Djava.security.egd=file:/dev/./urandom", + "-jar", + "/app.jar"] diff --git a/build.sh b/build.sh index 668c360..90173c6 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,2 @@ -mvn clean install - docker build -f Dockerfile -t mrmigles/pakhombot:latest . -docker push mrmigles/pakhombot:latest \ No newline at end of file +docker push mrmigles/pakhombot:latest diff --git a/pom.xml b/pom.xml index efb6f0a..706258b 100644 --- a/pom.xml +++ b/pom.xml @@ -20,9 +20,22 @@ UTF-8 UTF-8 - 1.8 + 21 + 4.0.20 + + + + org.apache.groovy + groovy-bom + ${groovy.version} + pom + import + + + + central @@ -52,6 +65,12 @@ spring-boot-starter-test test + + org.mockito + mockito-core + 5.14.0 + test + org.springframework.boot spring-boot-starter-data-mongodb @@ -162,12 +181,11 @@ org.projectlombok lombok - 1.16.22 + 1.18.36 - org.codehaus.groovy - groovy-all - 2.3.0 + org.apache.groovy + groovy @@ -194,6 +212,74 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + + + enforce-java + + enforce + + + + + 21 + + + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 21 + + --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.2 + + --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED + + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.2.0 + + + + toolchain + + + + + 21 + + + + + + org.springframework.boot spring-boot-maven-plugin