Authoring devfiles - Components
Adding an image component
You can add an image
component to a devfile.
Prerequisites
Procedure
Define a component using the type
image
.Specify the location of the Dockerfile using the
uri
property. Specify arguments to be passed during the build withargs
.buildContext
is the path of source directory to establish build context. IfrootRequired
is set to true, a privileged builder pod is required. The built container will be stored in the image provided byimageName
.An image dockerfile component
devfile.yamlcomponents: - name: outerloop-build image: imageName: python-image:latest autoBuild: true dockerfile: uri: docker/Dockerfile args: - 'MY_ENV=/home/path' buildContext: . rootRequired: false
Alternatively, specify
git
anddevfileRegistry
as the image source.When specifying
git
,fileLocation
refers to the location of the Dockerfile in the git repository. Specify theremotes
for the git repository and acheckoutFrom
to indicate whichrevision
to check the source from.An image dockerfile component with git source
devfile.yamlcomponents: - name: outerloop-build image: imageName: python-image:latest dockerfile: git: fileLocation: 'uri/Dockerfile' checkoutFrom: revision: 'main' remote: 'origin' remotes: 'origin': 'https://github.com/myorg/myrepo' buildContext: .
When specifying
devfileRegistry
,id
refers to the Id in a devfile registry that contains a Dockerfile.registryUrl
refers to the Devfile Registry URL to pull the Dockerfile fromAn image dockerfile component with devfileRegistry source
devfile.yamlcomponents: - name: outerloop-build image: imageName: python-image:latest dockerfile: devfileRegistry: id: python registryUrl: myregistry.devfile.com buildContext: .