Karyo
Documentation/ Operations

Container images

Karyo 2.1.1rendered at build time
On this page

Karyo ships as two images, both built from this repository: the application and the nginx front door. PostgreSQL and Keycloak come from public registries and are not Karyo images (infrastructure/docker/docker-compose.prod.yml, services.postgresql.image, services.keycloak.image).

Derived from infrastructure/docker/Dockerfile.service, infrastructure/docker/Dockerfile.nginx, .dockerignore, scripts/check-image-reproducibility.sh, scripts/scan-image.sh, scripts/deploy-server.sh, .github/workflows/ci.yml, .github/workflows/nightly.yml and .github/workflows/release.yml.

Image Built from Contains Licence label
application infrastructure/docker/Dockerfile.service the Quarkus fast-jar of :services:karyo-app - the complete product, engine capabilities included Apache-2.0
nginx infrastructure/docker/Dockerfile.nginx both front-end bundles and the reverse proxy Apache-2.0

The deploy script tags them karyo/karyo-app:latest and karyo/nginx:latest unless told otherwise (scripts/deploy-server.sh, KARYO_APP_IMAGE, KARYO_NGINX_IMAGE defaults). CI tags them karyo-app:<commit> and karyo-nginx:<commit> (.github/workflows/ci.yml, jobs.package.steps: Build the application image, Build the web image), starts them in karyo-starts, and publishes neither (where the images go). Only the release workflow publishes, and only for a pushed v* tag: it names them ghcr.io/voyagerforge-dev/karyo-app and ghcr.io/voyagerforge-dev/karyo-nginx, tagged with the version alone (releasing). No tag has been pushed through it yet, so no Karyo image exists in any registry today. The application image is the complete Apache-2.0 product.

Obtaining the images

Nothing can be pulled today; everything is built. An installation has two honest ways to obtain the images:

  1. Build them yourself with scripts/deploy-server.sh, which builds karyo/karyo-app and karyo/nginx from the checkout (deploying is the whole runbook).
  2. Pull a released version. A pushed release tag publishes both images as private packages on GHCR, linked to this repository (ADR 0056). No release has been published that way, and pulling them as an invited reader is promised only once an invited read-only account has proven a pull of both (ADR 0032). Until a release's notes name the images and their digests, a "karyo" image you find on a registry is not ours - build from source instead.

Either way, verify what you run: pin by digest, never by tag; read the image's NOTICE, LICENSE and THIRD-PARTY-NOTICES first (docker run --rm --entrypoint cat <image> /app/NOTICE, the --entrypoint is required); compare the CycloneDX SBOMs of the tag against THIRD-PARTY-NOTICES.md; and check the digest you pulled against the one the release records in its published.txt. A release makes no GitHub artifact attestation: GitHub offers them for a private repository only on Enterprise Cloud. They can be added if the repository goes public or the plan changes. The reproducibility contract (ADR 0023) means two builds of one tree give the same image, so a digest-pinned image is a reproducible artefact, not an unverifiable one; below says how far that holds across time.

Every image is built from the repository root

Both Dockerfiles take the repository root as their build context, each for its own reason: Dockerfile.service copies the fast-jar and the licence files staged beside it out of services/karyo-app/build/, and Dockerfile.nginx copies both frontend/ trees and the root licence files.

That makes .dockerignore at the root the only ignore file that applies to any image built here, and the file says so: a per-directory one beside a Dockerfile "is simply not consulted" (.dockerignore, the context-root ignore contract comment). It excludes every node_modules and dist, the docs tree, the operator's environment files and the licence signing-key file (.dockerignore, **/node_modules, **/dist, docs, scripts/.env.prod*, scripts/.license-signing-key). It also carries an instruction not to add **/build, because Dockerfile.service copies out of exactly that path.

Licence notices reach the recipient, not just the jar

Both runtime images carry NOTICE, LICENSE and THIRD-PARTY-NOTICES in /app/, with the same reasoning: Karyo's own module jars already carry them under META-INF (see building), but nobody reads a licence by unzipping a jar (Dockerfile.service, COPY ${SERVICE_DIR}/build/image-legal/ (licence-notice comment)). The nginx image copies them from the repository root (Dockerfile.nginx, COPY NOTICE LICENSE, COPY THIRD-PARTY-NOTICES.md). The application image copies what the build staged for it (Dockerfile.service, COPY ${SERVICE_DIR}/build/image-legal/): :services:karyo-app:imageLegalFiles, which quarkusBuild depends on, stages the three files for every build (services/karyo-app/build.gradle.kts, imageLegalFiles). There are no per-module licence markers or per-module licence directories in the image: at the Karyo 2.0.0 release the whole product is one Apache-2.0 distribution, and its NOTICE states that single grant. The documented invocation is

docker run --rm --entrypoint cat <image> /app/NOTICE

and the --entrypoint override is not optional, because Dockerfile.service's exec-form sh -c entrypoint would ignore the trailing argument and start the JVM instead.

Licence labels

The nginx image carries org.opencontainers.image.licenses="Apache-2.0", a literal (Dockerfile.nginx, LABEL org.opencontainers.image.licenses): every bundle it serves is Apache-2.0 front-end code.

The application image's label is also the literal Apache-2.0, in Dockerfile.service (Dockerfile.service, LABEL org.opencontainers.image.licenses): the whole product - engines included - is one Apache-2.0 application, so there is nothing for the label to vary on; the old IMAGE_LICENSES build argument and its disagree-check are gone. The deploy, scan and reproducibility scripts therefore pass no licence argument, and the production Compose file carries none.

Neither label enumerates the LGPL-2.1, EPL-2.0 and SIL-OFL-1.1 components a distribution contains; the third-party inventory copied beside NOTICE is what discloses them.

Provenance labels

Both images also carry four OCI labels, declared last in each Dockerfile so that a new revision invalidates no layer above them (Dockerfile.service, Dockerfile.nginx, LABEL org.opencontainers.image.source):

Label Value
org.opencontainers.image.source https://github.com/voyagerforge-dev/karyo-wms, a literal; it is what links a published package to this repository
org.opencontainers.image.version the release version; unreleased for any other build
org.opencontainers.image.revision the full commit; the deploy script sets it from the checked-out commit, as <commit>-dirty when the checkout has uncommitted changes, and any other build is unknown
org.opencontainers.image.created the commit time in UTC, never the wall clock, so two builds of one commit stay identical; the epoch for any other build

The release workflow sets the last three through the KARYO_VERSION, KARYO_REVISION and KARYO_CREATED build arguments and reads all five labels back before it scans (.github/workflows/release.yml, jobs.build.steps: Read the labels, licence files and packages back). CI passes none of them. The deploy script passes only KARYO_REVISION, the commit of its checkout (git describe --always --dirty --abbrev=40 --exclude='*': the full commit, or <commit>-dirty when the checkout has uncommitted changes, with one warning at deploy time; unknown outside a git work tree), so a deployed image names its commit; read it back with podman inspect --format '{{ index .Config.Labels "org.opencontainers.image.revision" }}' karyo/karyo-app:latest.

Base images, and three pinning disciplines

Site Base Tag style, and where a reason is recorded
Dockerfile.service, ARG JRE_BASE_IMAGE eclipse-temurin:21-jre-alpine Floating. The comment in Dockerfile.service records that the tag floats and why that is not enough on its own: it tracks Temurin's rebuild cadence, not Alpine's package feed, so the build runs apk upgrade. No reason for choosing a floating tag is recorded.
Dockerfile.nginx, ARG NODE_BASE_IMAGE (both builder stages) node:24-alpine Floating within Node 24. .nvmrc declares the Node major, and tests/e2e/fixtures/node-runtime-preflight.test.ts keeps the nginx builder stages equal to it. No reason for floating the minor and patch is recorded.
Dockerfile.nginx, ARG NGINX_BASE_IMAGE (the final stage) nginx:1.30.6-alpine Exact. The comment above the argument records Supported stable stream; scan the exact built image before release. No further reason is recorded.
docker-compose.prod.yml, services.postgresql.image postgres:16-alpine Floating within PostgreSQL 16. ADR 0022 names this image, and ADR 0028 records that the test profile uses the same one. No reason for floating the minor and patch is recorded.
docker-compose.prod.yml, services.keycloak.image quay.io/keycloak/keycloak:26.8.0 Exact. ADR 0047 records that managed installations use Keycloak 26.8 with resource-indicators and cimd, and ADR 0041 that Keycloak 26.6 and later offers both. No reason for pinning the patch is recorded.

Each Dockerfile names its bases once, as build arguments declared before the first FROM, and an ordinary build takes those tags. A release pins them: the release workflow pulls each tag once, resolves it to the linux/amd64 manifest digest it got, passes <tag>@<digest> as the build argument to every build and records the three digests in its evidence (.github/workflows/release.yml, jobs.build.steps: Resolve the base images to digests). The comments at the top of Dockerfile.service and Dockerfile.nginx give the reason: the tagged tree can be rebuilt from the same bases later. Even an exact tag is mutable; only a digest fixes image content. The PostgreSQL and Keycloak images are installation dependencies, not build bases, and this release step does not pin them.

Dockerfile.service adds USER karyo after creating an unprivileged account (Dockerfile.service, RUN addgroup, USER karyo). Dockerfile.nginx adds no USER: nginx's master process runs as root, as in the stock image, and it replaces the stock nginx.conf wholesale (Dockerfile.nginx, RUN rm /etc/nginx/conf.d/default.conf, COPY infrastructure/docker/nginx/nginx.conf) with a file that names the account of the worker processes, which are the ones that handle requests from the public origin: user nginx; (infrastructure/docker/nginx/nginx.conf, user). That is the unprivileged nginx account the base image creates, and it is the base image's own compiled-in default, written down so that a change of base image cannot change it silently. tests/e2e/fixtures/nginx-upstream-resolve.test.ts fails if the directive is removed.

The apk upgrade layer

Both runtime Dockerfiles run apk upgrade --no-cache && rm -f /var/log/apk.log before the application layers (Dockerfile.service, RUN apk upgrade --no-cache && rm -f /var/log/apk.log, Dockerfile.nginx, RUN apk upgrade --no-cache && rm -f /var/log/apk.log). The reason is stated in the file: a floating base tag tracks the publisher's rebuild cadence, not Alpine's package feed, so a freshly pulled base can lag the package fixes Alpine has already published, and the layer takes that catch-up instead of pinning a package version that is right only until the next advisory (Dockerfile.service, RUN apk upgrade (security-fix comment)).

How fresh the layer is depends on the build host, because it is cache-keyed on its own instruction text plus the parent layer, and a build reuses whatever base it already holds unless told to pull (Dockerfile.service, RUN apk upgrade (cache and pull-policy comment)):

  • CI and the nightly scan run on self-hosted runners that keep their image store between runs, so they build with --pull=always --no-cache: every such build pulls the current base and re-runs the upgrade layer rather than reusing either from an earlier run (.github/workflows/ci.yml, jobs.package.steps: Build the application image, Build the web image; .github/workflows/nightly.yml, jobs.scan.steps: Build the application image).
  • The deploy script builds with --no-cache (deploy-server.sh, build_image), so the upgrade layer re-runs on every full deploy, but on top of whichever base tag the host has cached: it does not pass --pull.
  • scripts/scan-image.sh passes --pull=always (scan-image.sh, podman build --pull=always), and its header records the size of the gap on one identical tree: 7 CRITICAL and 64 HIGH findings from a cached base, against 2 CRITICAL and 36 HIGH from a freshly pulled one (scan-image.sh, header cache rationale).

The comment at Dockerfile.service, RUN apk upgrade (cache and pull-policy comment) describes what a host that keeps its image store gets when it builds without those flags: the catch-up freezes at whatever base was last pulled. The CI runners are such hosts, which is why their builds pass both.

Scanning an image

The nightly scan job builds the application image fresh from main each night and runs Trivy on it, filtered to CRITICAL and HIGH with --exit-code 1 (.github/workflows/nightly.yml, jobs.scan). A pull request is not scanned: a finding fails that night's run, which opens or comments on the ci-nightly issue (the nightly workflow), so a vulnerability published since the last change is found without one. The scanner image is pinned by digest (nightly.yml, jobs.scan.steps: Run Trivy vulnerability scanner) and pulled only when the runner does not hold it, so a Docker Hub outage cannot fail a scan after the first pull. Trivy's vulnerability data is not pinned: the trivy-db volume refreshes itself when stale, so findings stay current while the scanner version moves only by an edit. To move it, replace the reference in nightly.yml, release.yml and scan-image.sh together (a repo-consistency test fails if the first and the last differ).

scripts/scan-image.sh is the local reproduction of that gate: it builds the application fast-jar and image, exports the image, and runs Trivy from its official container under the same severity filter and --exit-code 1 (scan-image.sh, Trivy invocation (header contract), Trivy invocation). It needs Podman and a JDK. The :ro,Z bind mount it uses is load-bearing on an SELinux-enforcing host, where a bare :ro is denied inside the scanning container with a message that reads like a file-permission problem (scan-image.sh, Trivy volume mount (:ro,Z)); the nightly scan keeps the same mount options so the two stay one gate.

The nightly scan covers the application image only, not nginx. The release workflow scans both images, with the same scanner digest, filter and gate, before it can publish either, and attaches the two reports to the release (.github/workflows/release.yml, jobs.build.steps: Scan both images). Whether main currently passes is the last nightly scan job.

Reproducibility

Two builds of identical content produce the same image ID, and both halves are needed to get there (ADR 0023):

  1. --timestamp 0 on Podman, or SOURCE_DATE_EPOCH=0 on Docker BuildKit, which has no equivalent flag. quarkusBuild restamps all 347 dependency jars with the build time on every run, so without this the 94 MiB lib/ COPY layer takes a fresh digest even when no dependency changed (scripts/check-image-reproducibility.sh, prove (header rationale)).
  2. Deleting /var/log/apk.log in the RUN that creates it. With the timestamp fix alone, that one 3.5 KB wall-clock-stamped file was the only remaining difference and still churned its whole 3.32 MiB layer (Dockerfile.service, RUN apk upgrade --no-cache && rm -f /var/log/apk.log).

scripts/check-image-reproducibility.sh is the guard and has two halves. --audit, the default, splits each declared build site into logical commands and requires every command that builds either Dockerfile to carry the determinism setting itself, or to be a call to a helper in the same file whose own build commands all carry it - which is how deploy-server.sh spells the two runtimes (check-image-reproducibility.sh, helper_is_deterministic, deploy-server.sh, build_image). The setting is never counted file-wide. The site list is fixed - .github/workflows/ci.yml, .github/workflows/nightly.yml, .github/workflows/release.yml, scripts/deploy-server.sh and scripts/scan-image.sh (check-image-reproducibility.sh, BUILD_SITES) - so a build in a new file is not detected. --prove builds the application image twice with --no-cache under Podman, restamping every lib/ modification time in between, and asserts that the image ID is unchanged (check-image-reproducibility.sh, prove).

The release workflow runs the audit in prepare, before anything is built (.github/workflows/release.yml, jobs.prepare.steps: Audit image-build determinism), so a change that drops the setting fails a release, and a dry run of one, before any image is built. A pull request runs neither the audit nor --prove. The release workflow then runs the proof itself on both images: each is built twice with --no-cache, every lib/ jar (application) or front-end file (nginx) restamped between the builds, and the run fails unless each pair of image IDs is equal (.github/workflows/release.yml, jobs.build.steps: Build the application image twice, Build the web image twice).

Across time the property is narrower. Two builds of one tree at one moment agree. A rebuild later agrees only when it starts from the same bases, which is why a release records their digests and builds from them; and even then the apk upgrade layer takes whatever Alpine's package feed serves on the day, so a release also records the installed package list of each image (apk-karyo-app.txt, apk-karyo-nginx.txt) for a later rebuild to be compared against.

What reproducibility buys is layer deduplication: an upgrade transfers only the layers whose content changed rather than the whole payload, and an unchanged release is recognisable as unchanged.

Front ends inside the image

Dockerfile.nginx is self-contained: two builder stages run npm ci && npm run build for frontend/web and frontend/mobile and copy their dist/ output into the serving image (Dockerfile.nginx, builder, mobile-builder stages and COPY --from).

An image-only installation runs scripts/deploy-server.sh --image-only with both released image references. It pulls and starts them without building either front end or checking for host Node or Java (see deploying). Digest references remain unchanged, so the serving image is exactly the released image.

The source-build mode runs no host front-end build either: Stage 3 of deploy-server.sh only announces that Stage 4 builds them, and a failed front-end build fails the nginx image build and stops the deploy. .dockerignore excludes host **/dist directories, so a host bundle could never replace the image's own build output. CI's frontend job checks the bundles separately from the image build.