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
uriproperty. Specify arguments to be passed during the build withargs.buildContextis the path of source directory to establish build context. IfrootRequiredis 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: falseAlternatively, specify
gitanddevfileRegistryas the image source.When specifying
git,fileLocationrefers to the location of the Dockerfile in the git repository. Specify theremotesfor the git repository and acheckoutFromto indicate whichrevisionto 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,idrefers to the Id in a devfile registry that contains a Dockerfile.registryUrlrefers 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: .