Registry
Building a custom devfile registry
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.
Procedure
Fork the devfile/registry repository.
Name your forked repository.
Add or remove any stacks you need from this repository.
Create a
stacks/
directory for storing the devfile stacks. Each directory understacks/
must correspond to a specific stack, for example,stacks/java-wildfly/
.To package any external devfile stacks or samples in your devfile registry, go to the root of your repository and create an
extraDevfileEntries.yaml
file.Add your devfile stacks to your
stacks/
directory.Verify every devfile stack contains at least one
devfile.yaml
file. 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.
Additional resources
Example of extraDevfileEntries.yaml.
To create devfile stacks, see creating a devfile stack.
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.
Prerequisites
Golang 1.18.x or higher
Docker 17.05 or higher
Git
Procedure
Run
./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:
DockerfileFROM registry.access.redhat.com/ubi8/go-toolset:1.18 AS builder # Run tasks as root USER root # Install yq RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/v4.9.5/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq # Copy registry contents 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 # Reset user as non-root USER 1001 FROM quay.io/devfile/devfile-index-base:next COPY /build/index.json /index.json COPY /build/stacks /stacks
Run
docker build -t devfile-index
to 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.
Generates
index.json
from the stacks in the repository and from any extra stacks or samples mentioned in theextraDevfileEntries.yaml
file.Builds a devfile index container image with the devfile stack contents and
index.json
.
Additional resources
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.
Procedure
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.
Additional resources
- For information on deploying the devfile index container image, see deploying a devfile registry.
- For information on deploying to air-gapped environment, see installation of in-cluster offline devfile registry.