From a2023da0702bae02cce5e3d5b73b6eef78f9925d 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] 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 227d4ec..ebfc026 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-focal 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-focal 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:focal ENV JAVA_HOME=/opt/jre diff --git a/docker/Dockerfile.github-actions b/docker/Dockerfile.github-actions index 948ed55..ca3861c 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-focal 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