You can add additional files to the build process with images. Input images are referenced in the same way the
To image targets are defined. This means both container images and image stream tags can be referenced. In conjunction with the image, you must provide one or more path pairs to indicate the path of the files or directories to copy the image and the destination to place them in the build context.
The source path can be any absolute path within the image specified. The destination must be a relative directory path. At build time, the image is loaded and the indicated files and directories are copied into the context directory of the build process. This is the same directory into which the source repository content is cloned. If the source path ends in
/. then the content of the directory is copied, but the directory itself is not created at the destination.
Image inputs are specified in the
source definition of the
- from: (2)
- destinationDir: injected/dir (4)
sourcePath: /usr/lib/somefile.jar (5)
pullSecret: mysecret (6)
- destinationDir: injected/dir
||An array of one or more input images and files.
||A reference to the image containing the files to be copied.
||An array of source/destination paths.
||The directory relative to the build root where the build process can access the file.
||The location of the file to be copied out of the referenced image.
||An optional secret provided if credentials are needed to access the input image.
If your cluster uses an
ImageContentSourcePolicy object to configure repository mirroring, you can use only global pull secrets for mirrored registries. You cannot add a pull secret to a project.
Images that require pull secrets
When using an input image that requires a pull secret, you can link the pull secret to the service account used by the build. By default, builds use the
builder service account. The pull secret is automatically added to the build if the secret contains a credential that matches the repository hosting the input image. To link a pull secret to the service account used by the build, run:
$ oc secrets link builder dockerhub
This feature is not supported for builds using the custom strategy.
Images on mirrored registries that require pull secrets
When using an input image from a mirrored registry, if you get a
build error: failed to pull image message, you can resolve the error by using either of the following methods:
Create an input secret that contains the authentication credentials for the builder image’s repository and all known mirrors. In this case, create a pull secret for credentials to the image registry and its mirrors.
Use the input secret as the pull secret on the