From 6e3f57d1bf4c3ae91c2c9e6a7a38e9e1b95a21b2 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Wed, 22 May 2019 13:25:54 +0200 Subject: [PATCH] Try to add a docker build thingy, guaranteed not to work :tm: --- .dockerignore | 136 ++++++++++++++++++ Dockerfile | 13 ++ build.gradle | 4 + gradlew | 0 .../commands/PermissionLevelCommand.kt | 3 +- 5 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile mode change 100644 => 100755 gradlew diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d4d0a9e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,136 @@ + +# Created by https://www.gitignore.io/api/java,gradle,intellij+all +# Edit at https://www.gitignore.io/?templates=java,gradle,intellij+all + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# 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/modules.xml +# .idea/*.iml +# .idea/modules + +# 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 + +# JetBrains templates +**___jb_tmp___ + +### 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 http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### 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.gitignore.io/api/java,gradle,intellij+all diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..063c036 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ + +FROM openjdk:8-stretch as build + +COPY . /app +WORKDIR /app +RUN ./gradlew bootJar + +FROM openjdk:8-jre-alpine + +COPY --from=build /app/build/libs/OttoBot*.jar /otto.jar +RUN chmod +x /otto.jar + +CMD java -jar /otto.jar \ No newline at end of file diff --git a/build.gradle b/build.gradle index ba4a8d4..7d270f2 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,10 @@ dependencies { } +bootJar { + mainClassName = 'nl.voidcorp.discord.MainKt' +} + compileKotlin { kotlinOptions { freeCompilerArgs = ["-Xjsr305=strict"] diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/kotlin/nl/voidcorp/discord/commands/PermissionLevelCommand.kt b/src/main/kotlin/nl/voidcorp/discord/commands/PermissionLevelCommand.kt index 79cebd7..1c7a17d 100644 --- a/src/main/kotlin/nl/voidcorp/discord/commands/PermissionLevelCommand.kt +++ b/src/main/kotlin/nl/voidcorp/discord/commands/PermissionLevelCommand.kt @@ -3,10 +3,11 @@ package nl.voidcorp.discord.commands import nl.voidcorp.discord.command.Command import nl.voidcorp.discord.command.CommandMessage import nl.voidcorp.discord.command.CommandResult +import nl.voidcorp.discord.command.CommandSource import org.springframework.stereotype.Component @Component -class PermissionLevelCommand : Command("permissions") { +class PermissionLevelCommand : Command("permissions", location = CommandSource.GUILD) { override fun handle(event: CommandMessage): CommandResult { event.reply("Your highest permission level is `${getLevel(event.member!!).levelName}`") return CommandResult.SUCCESS