From 673615fc15740f0806475eec7c70404a6a33f470 Mon Sep 17 00:00:00 2001 From: Marcel <34819524+MarcelCoding@users.noreply.github.com> Date: Tue, 15 Jun 2021 16:10:59 +0200 Subject: [PATCH 1/4] Added Spring Native Aot --- docker/Dockerfile | 9 +++++++-- docker/Dockerfile.github-actions | 4 ++-- luna-main/build.gradle | 10 +++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 259c921..0195bc5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,8 +39,12 @@ FROM eclipse-temurin:${JVM_VERSION}-jdk-jammy AS extractor WORKDIR /src -COPY --from=builder /src/luna-main/build/libs/luna-main-*.jar luna.jar -RUN java -Djarmode=layertools -jar luna.jar extract +COPY --from=builder /src/luna-main/build/libs/luna-main-*.jar . + +RUN rm -rf ./luna-main-*-all.jar ./luna-main-*-plain.jar ./luna-main-*-aot.jar \ + && mv luna-main-*.jar luna.jar \ + && java -Djarmode=layertools -jar luna.jar extract + FROM ubuntu:jammy @@ -76,6 +80,7 @@ ENV JAVA_APP_DIR=${DATA_DIR} ENV JAVA_MAIN_CLASS=org.springframework.boot.loader.JarLauncher ENV JAVA_APP_NAME=luna ENV JAVA_CLASSPATH=/opt/luna +ENV JAVA_OPTIONS="-DspringAot=true" USER ${LUNA_USER}:${LUNA_GROUP} VOLUME ${DATA_DIR} diff --git a/docker/Dockerfile.github-actions b/docker/Dockerfile.github-actions index b9c3ab2..851ed0d 100644 --- a/docker/Dockerfile.github-actions +++ b/docker/Dockerfile.github-actions @@ -27,8 +27,7 @@ FROM eclipse-temurin:${JVM_VERSION}-jdk-jammy AS extractor WORKDIR /src COPY ./luna-main-*.jar . -RUN rm -rf ./luna-main-*-all.jar ./luna-main-*-plain.jar \ - && ls \ +RUN rm -rf ./luna-main-*-all.jar ./luna-main-*-plain.jar ./luna-main-*-aot.jar \ && mv luna-main-*.jar luna.jar \ && java -Djarmode=layertools -jar luna.jar extract @@ -66,6 +65,7 @@ ENV JAVA_APP_DIR=${DATA_DIR} ENV JAVA_MAIN_CLASS=org.springframework.boot.loader.JarLauncher ENV JAVA_APP_NAME=luna ENV JAVA_CLASSPATH=/opt/luna +ENV JAVA_OPTIONS="-DspringAot=true" USER ${LUNA_USER}:${LUNA_GROUP} VOLUME ${DATA_DIR} diff --git a/luna-main/build.gradle b/luna-main/build.gradle index ce4a323..325014d 100644 --- a/luna-main/build.gradle +++ b/luna-main/build.gradle @@ -2,7 +2,7 @@ plugins { // id 'com.palantir.graal' id 'org.springframework.boot' id 'com.github.johnrengelman.shadow' -// id 'org.springframework.experimental.aot' + id 'org.springframework.experimental.aot' } dependencies { @@ -11,15 +11,15 @@ dependencies { implementation("de.m4rc3l.nova:nova-core:${novaVersion}") { changing true } runtimeOnly project(':luna-cacti') - runtimeOnly project(':luna-dvb') - runtimeOnly project(':luna-weather') + // runtimeOnly project(':luna-dvb') + // runtimeOnly project(':luna-weather') runtimeOnly 'org.postgresql:postgresql' // runtimeOnly 'org.liquibase:liquibase-core' annotationProcessor "com.github.therapi:therapi-runtime-javadoc-scribe:${therapiRuntimeJavadocVersion}" implementation "org.springdoc:springdoc-openapi-webflux-ui:${springDocVersion}" -// implementation "org.springdoc:springdoc-openapi-native:${springDocVersion}" + implementation "org.springdoc:springdoc-openapi-native:${springDocVersion}" implementation "org.springdoc:springdoc-openapi-javadoc:${springDocVersion}" implementation 'org.springframework.boot:spring-boot-starter-actuator' @@ -30,7 +30,7 @@ dependencies { // runtimeOnly 'io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.8.Final:linux-x86_64' // runtimeOnly 'io.netty:netty-tcnative-boringssl-static' - developmentOnly 'org.springframework.boot:spring-boot-devtools' +// developmentOnly 'org.springframework.boot:spring-boot-devtools' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.springframework:spring-context-indexer' // testImplementation 'org.springframework.boot:spring-boot-starter-test' From 4f81331e0aacb9f5b21ff51ecc80a4100188a388 Mon Sep 17 00:00:00 2001 From: Marcel <34819524+MarcelCoding@users.noreply.github.com> Date: Tue, 14 Dec 2021 09:15:05 +0000 Subject: [PATCH 2/4] Added luna-weather --- luna-main/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luna-main/build.gradle b/luna-main/build.gradle index 325014d..d5b22e0 100644 --- a/luna-main/build.gradle +++ b/luna-main/build.gradle @@ -12,7 +12,7 @@ dependencies { runtimeOnly project(':luna-cacti') // runtimeOnly project(':luna-dvb') - // runtimeOnly project(':luna-weather') + runtimeOnly project(':luna-weather') runtimeOnly 'org.postgresql:postgresql' // runtimeOnly 'org.liquibase:liquibase-core' From fff2ba77512cee9f9f2abdad1141954b473c6c1a Mon Sep 17 00:00:00 2001 From: Marcel <34819524+MarcelCoding@users.noreply.github.com> Date: Wed, 29 Dec 2021 12:53:33 +0100 Subject: [PATCH 3/4] Removed sentry --- luna-main/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/luna-main/build.gradle b/luna-main/build.gradle index d5b22e0..f13fda2 100644 --- a/luna-main/build.gradle +++ b/luna-main/build.gradle @@ -23,9 +23,9 @@ dependencies { implementation "org.springdoc:springdoc-openapi-javadoc:${springDocVersion}" implementation 'org.springframework.boot:spring-boot-starter-actuator' - implementation platform('io.sentry:sentry-bom:6.4.0') - implementation 'io.sentry:sentry-spring-boot-starter' - implementation 'io.sentry:sentry-logback' + // implementation platform('io.sentry:sentry-bom:6.4.0') + // implementation 'io.sentry:sentry-spring-boot-starter' + // implementation 'io.sentry:sentry-logback' // runtimeOnly 'io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.8.Final:linux-x86_64' // runtimeOnly 'io.netty:netty-tcnative-boringssl-static' From c3f09cb7f97c6f0f068cf5f126df721d44ba3af5 Mon Sep 17 00:00:00 2001 From: Marcel <34819524+MarcelCoding@users.noreply.github.com> Date: Sat, 26 Feb 2022 18:39:20 +0100 Subject: [PATCH 4/4] Improved dockerfiles --- .dockergitignore | 293 +++++++++++++++++++++++++++++++ docker/Dockerfile | 10 +- docker/Dockerfile.github-actions | 3 +- 3 files changed, 299 insertions(+), 7 deletions(-) create mode 100644 .dockergitignore diff --git a/.dockergitignore b/.dockergitignore new file mode 100644 index 0000000..7b1955e --- /dev/null +++ b/.dockergitignore @@ -0,0 +1,293 @@ +# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,macos,git,java,gradle,intellij+all,eclipse +# Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,macos,git,java,gradle,intellij+all,eclipse + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Eclipse Patch ### +# Spring Boot Tooling +.sts4-cache/ + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +### Gradle Patch ### +**/build/ + +# End of https://www.toptal.com/developers/gitignore/api/windows,linux,macos,git,java,gradle,intellij+all,eclipse + +lombok.config +cacti-uploads + +docker/Dockerfile* diff --git a/docker/Dockerfile b/docker/Dockerfile index 0195bc5..b444378 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,15 +11,14 @@ WORKDIR /src RUN set -o errexit -o nounset \ && chmod +x ./gradlew \ - && ./gradlew :luna-main:shadowJar :luna-main:assemble --stacktrace --no-daemon + && ./gradlew clean :luna-main:shadowJar :luna-main:assemble --stacktrace --no-daemon FROM eclipse-temurin:${JVM_VERSION}-jdk-jammy AS jre ARG JVM_VERSION +COPY --from=builder /src/luna-main/build/libs/luna-main-*-all.jar /src/luna.jar WORKDIR /src -COPY --from=builder /src/luna-main/build/libs/luna-main-*-all.jar luna.jar - RUN set -o errexit -o nounset \ && jdeps \ --ignore-missing-deps \ @@ -37,15 +36,14 @@ RUN set -o errexit -o nounset \ FROM eclipse-temurin:${JVM_VERSION}-jdk-jammy AS extractor +# the following line has to and with a slash, becuase contains multiple files +COPY --from=builder /src/luna-main/build/libs/luna-main-*.jar /src/ WORKDIR /src -COPY --from=builder /src/luna-main/build/libs/luna-main-*.jar . - RUN rm -rf ./luna-main-*-all.jar ./luna-main-*-plain.jar ./luna-main-*-aot.jar \ && mv luna-main-*.jar luna.jar \ && java -Djarmode=layertools -jar luna.jar extract - FROM ubuntu:jammy ENV JAVA_HOME=/opt/jre diff --git a/docker/Dockerfile.github-actions b/docker/Dockerfile.github-actions index 851ed0d..91e3dfb 100644 --- a/docker/Dockerfile.github-actions +++ b/docker/Dockerfile.github-actions @@ -24,9 +24,10 @@ RUN set -o errexit -o nounset \ FROM eclipse-temurin:${JVM_VERSION}-jdk-jammy AS extractor +# the following line has to and with a slash, becuase contains multiple files +COPY ./luna-main-*.jar /src/ WORKDIR /src -COPY ./luna-main-*.jar . RUN rm -rf ./luna-main-*-all.jar ./luna-main-*-plain.jar ./luna-main-*-aot.jar \ && mv luna-main-*.jar luna.jar \ && java -Djarmode=layertools -jar luna.jar extract