Adding an image component to a devfile
You can add an image
component to a devfile.
-
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
.Animage
dockerfile componentcomponents: - 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.Animage
dockerfile component with git sourcecomponents: - 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 fromAnimage
dockerfile component with devfileRegistry sourcecomponents: - name: outerloop-build image: imageName: python-image:latest dockerfile: devfileRegistry: id: python registryUrl: myregistry.devfile.com buildContext: .