Skip to main content

Hardened Images component

Build an application with Red Hat Hardened Images. Set the required type input to an application stack from the table below. There is no default stack. The table includes every language and runtime entry in the Red Hat catalog. The component generates a Containerfile with separate builder and runtime stages, then uses Buildah through the container component to publish, sign, and scan your application image. The build engine is fixed; there is no runtime selector.

Build a Node.js application​

You need a CI Tools runner that can build containers and reach the Red Hat catalog, registry, and signing-key service. Your project needs a package.json with a start script. Use a lock file to make dependency installation reproducible. The selected context must not already contain a project-owned Containerfile.

  1. Add this pipeline to .gitlab-ci.yml:

    include:
    - component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
    - component: $CI_SERVER_FQDN/xrow-public/ci-tools/hi@stable
    inputs:
    name: application
    type: nodejs
    version: "22"
    path: .
  2. Run the pipeline. generate:hi-application resolves compatible bases from the catalog, verifies their Red Hat signatures, and writes Containerfile and hi-images.json into the context. The build consumes these artifacts.

  3. Find your image at $CI_REGISTRY_IMAGE/application:$CI_COMMIT_SHA. The builder installs production dependencies and runs an optional build script. The fixed runtime command is npm start. Scanning is enabled by default.

Generation also runs in release pipelines. Generated files are artifacts, not commits pushed to your project. A failed version lookup or signature verification fails generation before the Containerfile is replaced or the build can start.

Select an image version​

version selects the image version, not the CI Tools component version. Use a quoted major ("22"), minor ("22.23"), or patch ("22.23.4") number that exists in the catalog. A major or minor selects the highest compatible numeric version with both builder and runtime variants. A patch selects that version. The generated FROM references include the catalog's immutable SHA-256 digests. hi-images.json records the request and resolved references.

Each generation reads the live catalog, so a later run can select a newer patch or rebuilt digest. The selected digests remain fixed throughout that build. Deprecated catalog versions, missing pairs, ambiguous digests, and invalid signatures fail rather than falling back to a different version or unsigned base.

The generator verifies each selected digest with Cosign and the Red Hat public signing key. It follows Red Hat's verification procedure for non-Red Hat hosts, which does not require an online transparency-log lookup. Signature and image claim checks remain required. A signature proves origin, not the absence of vulnerabilities; the application image must still pass scanning.

Select a stack​

Every stack has its own local template with separate builder and runtime sections. The public builder input can replace the upper section; the lower runtime section stays fixed. Runtime images run as user 65532 with group 0.

TypeDefault versionCatalog repositoryFixed runtime behavior
nodejs22nodejsRun npm start from /app.
php8.5phpRun PHP-FPM on port 9000; it needs a separate FastCGI web server.
html1.28nginxServe /usr/share/nginx/html over HTTP on port 8080.
python3.15pythonRun python3 app.py with /app/.venv/bin on PATH.
java21openjdkRun /app/app.jar with Java.
go1.26goRun the static /app/app binary in the separate core-runtime:2.43 stream.
ruby4.0rubyRun bundle exec ruby app.rb using the bundled application dependencies.
rust1rustRun /app/app, built from the Cargo binary named app.
swift6.4swiftRun /app/app, built from the Swift executable product named app.
dotnet-sdk10.0dotnet-sdkPublish and run /app/app.dll with the SDK image.
dotnet-runtime10.0dotnet-runtimePublish with the SDK and run /app/app.dll in the .NET runtime image.
aspnet-runtime10.0aspnet-runtimePublish with the SDK and run /app/app.dll; ASP.NET defaults to HTTP port 8080.

The PHP builder installs production Composer dependencies when composer.json exists. The Python builder creates a virtual environment and installs requirements.txt when present. Java expects an executable Maven wrapper and one target/*.jar. Go builds with CGO_ENABLED=0. Set path to your application context; HTML can use an already-built static directory.

Ruby requires a Gemfile and app.rb; bundle install installs dependencies under vendor/bundle. Rust and Swift expect the default executable product name app; use builder for another build convention. The .NET builder publishes with assembly name app into /app/publish.

For dotnet-runtime and aspnet-runtime, version selects the runtime version. Their SDK uses the same major/minor stream because SDK and runtime patch numbers differ. Both references are independently digest-pinned and signature-verified. For example, runtime 10.0.13 uses a compatible 10.0 SDK, not a nonexistent SDK with that same patch number.

Customize the builder​

Use builder for a complete build-stage replacement. Keep the verified image variable and the builder stage name. The fixed lower section copies /app, or /app/publish for the .NET types. Only the two HI image variables are substituted. Other shell and Containerfile variables remain literal data until the container build interprets them.

include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/hi@stable
inputs:
type: nodejs
version: "22"
path: service
builder: |
FROM ${HI_BUILD_IMAGE} AS builder
USER 0
WORKDIR /app
COPY . .
RUN npm ci && npm run build && npm prune --omit=dev && chmod -R g=u /app

Additional unsigned or unrelated base images are rejected. Keep compiled outputs compatible with the fixed runtime. For a different runtime or a project-owned Containerfile, use the container component instead. Do not place credentials in build commands, arguments, or sources. Use the inherited secrets input with build-stage secret mounts for private dependencies. Exclude credentials, local caches, and generated output with .containerignore.

Migrate from S2I​

Keep name, type, path, dependencies, runner tags, and scanning settings. Replace the s2i include with hi, then choose an image version. HI does not provide S2I assemble/run scripts or consume .s2i/environment. Move assembly logic into builder and configure runtime environment variables in your deployment. Check the fixed commands and ports before deploying; PHP uses FastCGI rather than an HTTP server.

Inputs​

NameDescriptionDefaultType
------------
builderReplace the builder Containerfile section; the runtime stays fixed.string
cache-enabledShould registry-backed build cache be used?falseboolean
dependenciesThe dependencies that this job depends on.[]array
nameName for the pipeline jobs and the container.$CI_PROJECT_NAMEstring
needsThe jobs that this job depends on.[]array
pathPath to the directory containing Container sources / context..string
registryRegistry to store container image releases in$CI_REGISTRYstring
repository-pathRepository to store container image releases in$CI_REGISTRY_PROJECT_PATHstring
rulesThe jobs that this job depends on.[{"if":"$CI_PIPELINE_SOURCE == \"schedule\"","when":"never"},{"if":"$CI_PIPELINE_SOURCE == \"merge_request_event\"","when":"on_success"},{"when":"on_success"}]array
scannersScanners to use. none, vuln, license, secret, misconfig["vuln","secret","license","misconfig"]array
scanning-allow-failureShould the pipeline fail if scanning the built container image fails?falseboolean
scanning-enabledShould the built container image be scanned?trueboolean
scanning-ignore-unfixedExclude vulnerabilities that do not have a fix available.trueboolean
scanning-severityWhat level of severity should cause scanning of the built container to fail?CRITICALstring
scanning-timeoutHow long should the scanning process be allowed to run before timing out? Use format e.g. 5m0s30m0sstring
secretsSecrets to pass to the builder.string
signing-enabledShould the built container image be signed?trueboolean
stageThe pipeline stage that the jobs belongs to.buildstring
tagsThe runners that this job depends on.[]array
typeApplication stack to build with Red Hat Hardened Images.string
versionHI image version (major, minor or patch); empty uses the stack default.string