Detection

migetpacks detects a Kotlin application when any of the following conditions are met:
  • settings.gradle.kts exists
  • .kt files exist in src/ directory
  • build.gradle.kts contains the kotlin plugin
  • build.gradle (Groovy DSL) contains a Kotlin plugin reference
Kotlin detection takes priority over Java/Gradle detection. If your project has build.gradle.kts with Kotlin plugins, it will be identified as Kotlin rather than Java.

Version Detection

Kotlin Version

Kotlin version is resolved in the following priority order:

Java Version

The JDK version used for compilation and runtime is read from:

Build Process

migetpacks generates a multi-stage Dockerfile using Eclipse Temurin JDK with Gradle:

Gradle Wrapper

If gradlew is present in the project root, migetpacks uses the Gradle Wrapper for correct version compatibility. Otherwise, it falls back to the system Gradle.

Run Command

The default run command for Kotlin applications:
Override with RUN_COMMAND or a Procfile:

JVM Configuration

The following environment variables are set for production:

Caching

Layer Caching

Dependencies are cached by copying Gradle build files before the full source:

BUILD_CACHE_DIR

When BUILD_CACHE_DIR is set, Gradle caches persist at:

DHI Support

Docker Hardened Images are supported for Kotlin builds.

DHI Notes

  • Java version is read from system.properties (java.runtime.version), defaulting to 21.
  • Eclipse Temurin DHI JDK images include the JDK but Gradle must be available (via wrapper or system install).
  • Runtime images are distroless (no shell).
  • The nonroot user is used instead of the miget user.

Example with DHI

Example

With build cache