Packaging
Status: ⚪ Planned —
[package.docker]parses, butkargo packageis not implemented. This page describes the intended behavior. See Implementation Status.
Publishing produces Maven artifacts for other builds to consume. Packaging
produces things people and machines run: a JAR you can java -jar, a container
image, an XCFramework for Xcode.
kargo package
By target
| Target | Default output |
|---|---|
jvm | Fat JAR with dependencies bundled |
android | APK, or AAB with --bundle |
ios-* | .framework, or an XCFramework with --ios-universal |
js | Bundled .js plus .d.ts declarations |
linux-x64, mingw-x64, macos-* | Native executable |
wasm-js | .wasm plus JavaScript glue |
Output lands in build/<target>/<profile>/dist/.
JVM
kargo package # fat JAR
kargo package --format thin # JAR plus a lib/ directory
kargo package --format dist # ZIP with bin/ launcher scripts and lib/
| Format | Use when |
|---|---|
| Fat JAR | A single file to copy and run. Simplest to deploy. |
| Thin | Dependencies change less often than your code — layer them in a container. |
| Dist ZIP | You want launcher scripts for Unix and Windows. |
Fat JARs need a duplicate strategy, because two dependencies will eventually both
ship META-INF/services/…:
[package.jar]
main-class = "com.example.MainKt"
merge-service-files = true
exclude = ["META-INF/*.SF", "META-INF/*.DSA"]
merge-service-files concatenates META-INF/services entries instead of letting
one overwrite the other. Without it, a service-loader-based library — most JDBC
drivers, many logging bridges — silently stops finding its implementations. The
exclusions drop signature files that are invalid once a JAR is repackaged.
Docker
kargo package --docker
kargo package --docker --tag my-service:1.2.0
kargo package --docker --push
[package.docker]
base-image = "eclipse-temurin:25-jre-alpine"
ports = [8080]
entrypoint = "java -jar /app/app.jar"
labels = { maintainer = "team@example.com" }
Kargo generates the Dockerfile and builds the image. With no base-image, it
picks a JRE matching your java-target.
The generated Dockerfile copies dependencies and application code in separate layers, so a code-only change does not invalidate the dependency layer — the difference between a 2 MB push and a 200 MB one.
Bring your own Dockerfile when you need to:
kargo package --docker --dockerfile ./Dockerfile
Apple frameworks
kargo package --target ios-arm64 # device framework
kargo package --ios-universal # XCFramework: device + simulator
kargo package --target macos-arm64 --format app-bundle
An XCFramework is what an Xcode project should consume: one bundle containing every architecture, so Xcode picks the right slice for device and simulator builds without a build-phase script.
import MyLib
let greeting = Greeting().greet()
Native binaries
kargo package --target linux-x64
kargo package --target mingw-x64
kargo package --target macos-arm64
Produces a self-contained executable with no JVM required. Each needs a matching host — Kotlin/Native does not cross-compile between operating systems.
Signing
kargo package --sign
[signing]
gpg-key = "${env:GPG_KEY_ID}"
gpg-password = "${env:GPG_PASSPHRASE}"
Apple targets use Xcode's signing identity for code signing; JVM and native artifacts get detached GPG signatures. See Secrets for handling the credentials.
In CI
- run: kargo package --release
- uses: actions/upload-artifact@v4
with:
name: dist
path: build/*/release/dist/
Package from a tag, not from every commit — see Continuous Integration.
Next
- Publishing — Maven artifacts instead
- Continuous Integration
- Compose Multiplatform — packaging UI applications