Provide your developers a devfile registry so they can access devfile stacks and samples, enabling them to use devfiles to simplify and improve their containerized application development.
To create a devfile registry for your team’s container development:
Create a Git repository.
Build a devfile registry.
Tag and push the registry container image.
Creating a Git repository
Set up a Git repository to store the devfile stacks to package into the devfile registry.
Fork the devfile/registry repository.
Name your forked repository.
Add or remove any stacks you need from this repository.
stacks/directory for storing the devfile stacks. Each directory under
stacks/must correspond to a specific stack, for example,
To package any external devfile stacks or samples in your devfile registry, go to the root of your repository and create an
Add your devfile stacks to your
Verify every devfile stack contains at least one
devfile.yamlfile. Add other required files to the stacks. These files can include VSX plug-ins, Dockerfiles, or Kubernetes manifests.
The registry build tool automatically validates your customized registry.
Building a custom devfile registry
Make your repository into a devfile registry by building a
devfile index container image. Deploy the
devfile index image to your cloud or cluster to form the devfile registry.
Golang 1.13.x or higher
Docker 17.05 or higher
./build_image.sh <path-to-devfile-registry-folder>to build a devfile registry repository.
In a multi-stage Docker build, add a Dockerfile to your devfile registry repository. Make sure the Dockerfile contains the following:Dockerfile
FROM quay.io/openshift-pipeline/golang:1.15-alpine AS builder # Install dependencies RUN apk add --no-cache git bash COPY . /registry # Download the registry build tools RUN git clone https://github.com/devfile/registry-support.git /registry-support # Run the registry build tools RUN /registry-support/build-tools/build.sh /registry /build FROM quay.io/devfile/devfile-index-base:next COPY /build/index.json /index.json COPY /build/stacks /stacks
docker build -t devfile-indexto build the devfile registry into a container image.
The build script builds the index generator, generates the
index.json file from the specified devfile registry, and builds the stacks and
index.json into a devfile index container image. The registry build process takes the contents of your devfile registry Git repository and:
Packages the content of each devfile stack based on the supported media types for the devfile registry.
Validates the content of the devfile registry repository based on the expected registry structure.
index.jsonfrom the stacks in the repository and from any extra stacks or samples mentioned in the
Builds a devfile index container image with the devfile stack contents and
For examples on how to add Dockerfiles to your devfile registry, see the devfile/registry repository’s Dockerfile.
To run the registry build outside a container build, see the devfile registry build tools.
Tagging and pushing a registry container image
Use the devfile index container image to create a container in which you build, run, and deploy your application.
Choose a container registry.
Consult the documentation for your container registry and log in to the registry with the Docker CLI.
Push the devfile index container image to your chosen container registry:
$ docker tag -f devfile-index __<registry-hostname>__/__<registry-username>__/devfile-index:latest $ docker push __<registry-hostname>__/__<registry-username>__/devfile-index:latest
If your container does not build properly, consult the documentation for your container registry.
- For information on deploying the devfile index container image, see deploying a devfile registry.