Type to search pages and rules.

Browse pages

Container Deployment

This extension defines image and rollout requirements for hosted environments that deploy immutable images.

Markdown25 provisions

Intent#

This extension defines image and rollout requirements for hosted environments that deploy immutable images. It supplements baseline release and operations standards.

Activation#

Activation scope: project.

Applicable specification kinds: None.

The consumer enables containers when production or staging deploys the API, Worker, or frontend as a container image.

Baseline relationship#

This extension replaces no baseline provision. Its schema, rollback, and secret rules cite the baseline rules that own those obligations.

This extension switches on limit and runbook. litespec/ext/containers#declare-writable-paths-and-limits records resource bounds as Limit records. litespec/ext/containers#retain-rollback-material records the rollback procedure as a Runbook record.

Standards#

Build release images in stages#

rulecheckable

Requirement A release image MUST use multi-stage builds and pinned base-image digests.

Rationale Staged builds isolate build tooling, and pinned digests identify the reviewed base image.

litespec/ext/containers#build-release-images-in-stages

Run images as non-root#

rulecheckable

Requirement A release image MUST run its application with a non-root runtime user.

Rationale A non-root process limits the effect of an application compromise.

litespec/ext/containers#run-images-as-non-root

Copy only runtime files#

rulecheckable

Requirement A runtime image MUST contain only files required to run the deployed application.

Rationale A small runtime layer reduces attack surface and image transfer cost.

litespec/ext/containers#copy-only-runtime-files

Exclude build material from runtime images#

rulecheckable

Requirement A runtime image MUST NOT contain source, tests, package caches, or local configuration.

Rationale Build-only material has no production runtime purpose. Secrets stay out under litespec/quality/security#keep-secrets-out-of-tracked-and-observable-data.

litespec/ext/containers#exclude-build-material-from-runtime-images

Supply runtime configuration externally#

rulecheckable

Requirement A deployment platform MUST supply connection strings, OIDC settings, exporter endpoints, and secrets outside the image.

Rationale Deployment-owned configuration can differ by environment without rebuilding the application image.

litespec/ext/containers#supply-runtime-configuration-externally

Exclude environment configuration from images#

rulecheckable

Requirement A release image MUST NOT contain environment-specific configuration.

Rationale An immutable image remains deployable only when environment values stay external.

litespec/ext/containers#exclude-environment-configuration-from-images

Apply schema work before traffic#

rulecheckable

Requirement A release job MUST apply reviewed schema changes before traffic shifts to new application replicas, under litespec/backend/persistence#control-production-schema-changes.

Rationale The release job is the container platform's form of the reviewed step the baseline rule requires.

litespec/ext/containers#apply-schema-work-before-traffic

Keep schema work out of startup#

rulecheckable

Requirement An application replica MUST NOT alter the production schema during startup, under litespec/backend/persistence#control-production-schema-changes.

Rationale Replica startup can occur concurrently and lacks release-job control.

litespec/ext/containers#keep-schema-work-out-of-startup

Wait for replica readiness#

rulecheckable

Requirement A deployment controller MUST start new replicas and wait for readiness before shifting traffic.

Rationale Readiness proves the new application can receive traffic before it becomes active.

litespec/ext/containers#wait-for-replica-readiness

Test released traffic#

rulecheckable

Requirement A release deployment MUST run the release's recorded end-to-end suite after traffic reaches the new version.

Rationale The test verifies the deployed path rather than only an image build. The release record names the suite.

litespec/ext/containers#test-released-traffic

Retain rollback material#

rulecheckable

Requirement A release owner MUST record the rollback procedure as a Runbook record identifying the previous image digest, under litespec/quality/operations#keep-rollback-executable.

Rationale The digest identifies one immutable image. The Runbook carries the tested command.

litespec/ext/containers#retain-rollback-material

Limit container privileges#

rulecheckable

Requirement A deployment MUST use a read-only filesystem when the application permits it and drop unnecessary capabilities.

Rationale Runtime filesystem and capability limits reduce available compromise actions.

litespec/ext/containers#limit-container-privileges

Declare writable paths and limits#

rulecheckable

Requirement A deployment MUST declare writable paths and record CPU and memory bounds as Limit records.

Rationale Explicit limits protect node capacity and document required mutable storage.

litespec/ext/containers#declare-writable-paths-and-limits

Run the application as PID 1#

rulecheckable

Requirement A container MUST run the application as its entry process.

Rationale The application then receives the deployment platform's termination signals.

litespec/ext/containers#run-the-application-as-pid-1

Set sufficient shutdown time#

rulecheckable

Requirement A deployment MUST set a shutdown grace period longer than measured request or Worker stop time.

Rationale In-flight work needs enough time to finish or record safe interruption.

litespec/ext/containers#set-sufficient-shutdown-time

Write runtime logs to streams#

rulecheckable

Requirement A containerized application MUST write logs to standard output or standard error.

Rationale The deployment platform owns log collection for the immutable process.

litespec/ext/containers#write-runtime-logs-to-streams

Keep mutable data external#

ruleguidance

Requirement A containerized application MUST keep mutable data outside its container filesystem.

Rationale Recreated replicas cannot rely on local mutable filesystem state.

litespec/ext/containers#keep-mutable-data-external

Apply OCI release labels#

rulecheckable

Requirement A release image MUST include OCI source, revision, version, and created-time labels.

Rationale Standard labels connect the image to source and release records.

litespec/ext/containers#apply-oci-release-labels

Record image digests#

rulecheckable

Requirement A release record MUST store the deployed image digest rather than only an image tag.

Rationale A tag can move, while a digest identifies one immutable image.

litespec/ext/containers#record-image-digests

Exclude build timestamps from contracts#

rulecheckable

Requirement A published OpenAPI document or generated client MUST NOT contain a build timestamp.

Rationale Build timestamps create nondeterministic generated output without application meaning. A generated-at field and a build-time comment are both build timestamps.

litespec/ext/containers#exclude-build-timestamps-from-contracts

Separate frontend configuration classes#

ruleguidance

Requirement A frontend image build MUST distinguish public build-time configuration from server-only runtime secrets.

Rationale Browser bundles can contain only public values, while server secrets remain private.

litespec/ext/containers#separate-frontend-configuration-classes

Use protected frontend secret delivery#

ruleguidance

Requirement A frontend image build MUST use secret mounts or runtime injection for secrets.

Rationale Protected delivery keeps secrets outside persistent image history.

litespec/ext/containers#use-protected-frontend-secret-delivery

Exclude insecure frontend secret carriers#

rulecheckable

Requirement A frontend image build MUST NOT use ARG, copied environment files, or image layers for secrets.

Rationale Build arguments, copied files, and layers can retain a secret in image history. Secrets stay out of layers under litespec/quality/security#keep-secrets-out-of-tracked-and-observable-data.

litespec/ext/containers#exclude-insecure-frontend-secret-carriers

Conventions#

Place Dockerfiles beside deployables#

conventioncheckable

Default Keep one Dockerfile beside each deployable application.

Replacement A consumer records a departure from this default as an Exception record with reason, review date, and removal condition.

Rationale The Dockerfile stays near the project that defines its runtime output.

litespec/ext/containers#place-dockerfiles-beside-deployables

Build from the workspace root#

conventioncheckable

Default Build images from the workspace root when shared project or package files are required.

Replacement A consumer records a departure from this default as an Exception record with reason, review date, and removal condition.

Rationale Root context supplies shared build inputs while the Dockerfile excludes unrelated secrets.

litespec/ext/containers#build-from-the-workspace-root

Dependencies#

This extension requires no application package.

Verification#

IDMarkEvidence
litespec/ext/containers#build-release-images-in-stagescheckableContainersImageTests assert multi-stage builds and digest-pinned release bases.
litespec/ext/containers#run-images-as-non-rootcheckableContainersImageTests assert the declared non-root runtime user.
litespec/ext/containers#copy-only-runtime-filescheckableContainersImageTests match the image file listing against the declared runtime manifest.
litespec/ext/containers#exclude-build-material-from-runtime-imagescheckableContainersImageTests find no build-only files or local configuration in runtime images.
litespec/ext/containers#supply-runtime-configuration-externallycheckableContainersConfigTests match deployment manifests against runtime values declared outside the image.
litespec/ext/containers#exclude-environment-configuration-from-imagescheckableContainersConfigTests find no environment-specific configuration in release images.
litespec/ext/containers#apply-schema-work-before-trafficcheckableContainersSchemaTests place the reviewed schema job before the traffic shift.
litespec/ext/containers#keep-schema-work-out-of-startupcheckableContainersSchemaTests observe no production schema mutation from replica startup.
litespec/ext/containers#wait-for-replica-readinesscheckableContainersTrafficTests assert new replicas reach readiness before traffic shifts.
litespec/ext/containers#test-released-trafficcheckableContainersTrafficTests pass after new-version traffic shift.
litespec/ext/containers#retain-rollback-materialcheckableContainersRollbackTests resolve the Runbook record and its previous image digest.
litespec/ext/containers#limit-container-privilegescheckableContainersSecurityTests assert read-only filesystem and dropped capabilities in the deployment manifest.
litespec/ext/containers#declare-writable-paths-and-limitscheckableContainersSecurityTests match the manifest against declared writable paths and Limit records.
litespec/ext/containers#run-the-application-as-pid-1checkableContainersProcessTests confirm the application receives the container stop signal.
litespec/ext/containers#set-sufficient-shutdown-timecheckableContainersProcessTests assert in-flight work stops within the declared grace period.
litespec/ext/containers#write-runtime-logs-to-streamscheckableContainersProcessTests assert container logs appear on standard output or standard error.
litespec/ext/containers#keep-mutable-data-externalguidanceDoes the design keep every piece of mutable data outside the container filesystem?
litespec/ext/containers#apply-oci-release-labelscheckableContainersMetadataTests assert the four required OCI labels on built images.
litespec/ext/containers#record-image-digestscheckableContainersMetadataTests identify the deployed artifact by immutable digest in the release record.
litespec/ext/containers#exclude-build-timestamps-from-contractscheckableContainersMetadataTests assert the generated-contract diff contains no build timestamp.
litespec/ext/containers#separate-frontend-configuration-classesguidanceDoes the frontend build keep public configuration apart from server-only secrets?
litespec/ext/containers#use-protected-frontend-secret-deliveryguidanceDoes the frontend build deliver every secret through mounts or runtime injection?
litespec/ext/containers#exclude-insecure-frontend-secret-carrierscheckableContainersConfigTests reject ARG, copied environment files, and secret-bearing layers.
litespec/ext/containers#place-dockerfiles-beside-deployablescheckableContainersTests assert a colocated Dockerfile per deployable or a recorded Exception.
litespec/ext/containers#build-from-the-workspace-rootcheckableContainersTests assert image builds access declared shared inputs from repository-root context.