For the complete documentation index, see llms.txt. This page is also available as Markdown.

Integrating with your container build pipeline

Wire the `seal fix --os`-bearing Dockerfile into the CI system that builds, tests, and pushes your container images.

The previous chapter covered the Dockerfile side: where seal fix --os goes inside an image build and what credentials it needs. This chapter covers the surrounding CI pipeline: how to invoke that build from your CI system, how to pass SEAL_TOKEN from the CI's secret store, and how to sequence the sealing step against the rest of your image-delivery workflow.

The sealing step itself is the same regardless of which CI system drives the build. What differs is how each system exposes secrets and how each system invokes docker build.

The general shape

A container build pipeline that runs Seal OS has the same three phases as any other container delivery pipeline:

  1. Build: docker build against a Dockerfile that runs seal fix --os somewhere in its final stage. SEAL_TOKEN and SEAL_PROJECT reach the build through --build-arg (or BuildKit build secrets).

  2. Test: optional but recommended. Run the resulting image against your test suite to confirm the sealed packages do not regress runtime behavior.

  3. Push: tag and push the image to your registry.

The only Seal-specific concern is phase 1. The test and push phases are unchanged.

Per-CI patterns

The pattern is identical to the patterns documented for application sealing in Seal Apps via the Seal CLI in CI/CD. The only differences are the Dockerfile (uses seal fix --os instead of, or in addition to, seal fix) and the credentials path (always through --build-arg or build secrets, since the seal step runs inside docker build).

The Dockerfile the CI invokes

Each CI snippet below runs docker build against a Dockerfile in the repo root. The relevant lines for the seal step are the package install followed by the seal call:

FROM alpine:3.20

# 1. Install the OS packages your application needs (and any upgrades).
RUN apk add --no-cache curl ca-certificates openssl

# 2. Pull in the Seal CLI.
ADD --chmod=755 https://github.com/seal-community/cli/releases/download/latest/seal-linux-amd64-latest /usr/local/bin/seal

# 3. Run seal fix --os after the install step, so the full installed set is sealed.
ARG SEAL_TOKEN
ARG SEAL_PROJECT=my-project-id
RUN seal fix --os --mode all --remove-cli

# 4. The rest of the build proceeds against the now-sealed OS layer.
COPY . /app

The full Dockerfile reference is in Sealing OS packages in a Dockerfile. The CI snippets below show how to invoke docker build against this shape.

The token rides through as a BuildKit secret. The Dockerfile reads it with RUN --mount=type=secret,id=SEAL_TOKEN .... The --build-arg form is also valid; see the Dockerfile patterns for the ARG SEAL_TOKEN shape.

SEAL_TOKEN and REGISTRY_* are configured as GitLab CI/CD variables (masked and protected). The runner exports them as environment variables; the script references them through the regular shell interpolation.

SEAL_TOKEN is configured as a secret pipeline variable. The $(SEAL_TOKEN) syntax expands the value at task-run time; the env mapping makes that explicit.

Store the token in Jenkins as a credential and reference it with credentials(...).

SEAL_TOKEN lives in a CircleCI context named seal-secrets. The workflow attaches the context to the job, which makes SEAL_TOKEN available as an environment variable to every step in the job.

Cache and tag strategy

seal fix --os resolves against whatever Seal has published at build time. Treat the image you push as a snapshot of the sealed-package set at that moment, and tag accordingly. Two patterns work:

  • Immutable tags per commit (the pattern shown above): tag with the commit SHA. The image is reproducible from the same source plus the same seal fix --os run timestamp; if a downstream consumer needs to reproduce it later they may not get the same sealed versions.

  • Floating tag plus periodic rebuild: tag with latest (or main) and run the pipeline on a schedule (daily, weekly) regardless of whether the source has changed. Each scheduled build picks up any newer sealed versions Seal has published since the last build. This is the closest equivalent to --mode all with rolling safest tracking.

For regulated environments that need bit-for-bit reproducibility of the image, use --mode local or --mode remote with pinned Sealing Rules so the sealed versions the build resolves against are explicit in your source.

Testing the sealed image

The same image you ship is the one your tests run against. A short verification step in the same pipeline gives you a chance to catch the rare case where a sealed version shifts behavior:

For deeper coverage, mount your existing integration tests against the freshly built image rather than against the upstream base image.

When seal fix and seal fix --os both run

A pipeline that produces a container image with both application dependencies (npm, Maven, pip, Go, and so on) and OS packages typically runs both seal fix (for application dependencies) and seal fix --os (for OS packages) inside the same Dockerfile.

Use a different SEAL_PROJECT for each. Each CLI scan tells the Seal Platform which packages it discovered; the next scan against the same project marks every previously-reported package the current scan did not see as stale, so it falls off the Protection page. Because seal fix and seal fix --os discover disjoint sets (application packages vs. OS packages), sharing a SEAL_PROJECT between them makes the second invocation silently bury the first invocation's discovery. The on-disk fixes still happen, but Seal's view of the image's package coverage is reduced to whichever scan ran last.

The recommended layout creates one project per scan, both under the same tenant. For example:

The two seal steps are independent and can run in either order. Putting seal fix --os last (and using --remove-cli on it) keeps the CLI in the image for the application-dependency seal step and removes it afterward in one clean motion.

Pass both SEAL_PROJECT_APP and SEAL_PROJECT_OS as --build-arg values from your CI, the same way SEAL_TOKEN is passed. The token is shared across both projects; only the project IDs differ.

Last updated