Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
gradle/wrapper
src/main
.gitignore
README.md
build.gradle.kts
gradle.properties
gradlew
gradlew.bat
settings.gradle.kts

README.md

Containerize a Ktor application with Jib

This is an example of how to easily build a Docker image for a Ktor application with Jib.

./gradlew jibDockerBuild

docker run --rm -p 8080:8080 ktor-jib-example:1

The application can also be ran outside of Jib's build process via ./gradlew run

Defined environment variables

A few variables have been added in the code-base to show case some of the unique features of Ktor.

  • KTOR_APP_ID - The name of the application in the logs
    • Type: String
  • KTOR_METRICS_ENABLED - Exposes JMX Metrics through the application port (8080)
    • Type: Boolean (default: false)
  • KTOR_ROUTE_TRACING - Enables verbose logging of route matches for debugging complex/nested routing tables
    • Type: Boolean

More information

Learn more about Jib.

Learn Ktor.

Analytics

You can’t perform that action at this time.