Docker Image
Build component for Docker images
Introduction
Docker Image Components are useful when you don't have your images already built (by a pipeline). Defining such a component will enable Bunnyshell to build your images for you to use in other components.
Docker Image components are not displayed in the main user interface. They can be defined and edited only with the bunnyshell.yaml
file, where they have their own kind, named DockerImage
.
Example
-
kind: DockerImage
version: v1
name: my-app-image
context: /
dockerfile: Dockerfile
target: null
args:
ENV: bunnyshell
gitRepo: 'https://gitlab.com/example/my-app.git'
gitBranch: master
gitApplicationPath: /
Attributes
Docker Image Components have the following attributes:
context
: the path to the Dockerfile relative to the Git branch.dockerfile
: the name of the Dockerfile. This attribute is relative to the context.target
: the name of the stage that is to be built from the Dockerfile.args
: Docker build args that can be used in the image.version
: Bunnyshell's definition versionname
: the namegitRepo
: the URL of the Git repository where the Dockerfile is located. This field is mandatory.gitBranch
: the branch where the Dockerfile is located. This attribute is relative to the gitRepo. This field is mandatory.gitApplicationPath
: the path to the application folder, relative to the branch. This field is mandatory.
Note
If the gitRepo, gitBranch and gitApplicationPath are not provided, Bunnyshell will return an error when trying to validate your environment.
Bunnyshell must have access to the git repository through an existing Git integration (i.e. a Git account that was already connected to Bunnyshell). See the Git Providers page for more information.
Value Interpolation
The images can be used in other components using the following interpolations:
{{ components.NAME.image }}
: contains full image name, including the tag.
Example:nginx:latest
{{ components.dev_test_image.imageName }}
: contains only the image name.
Example:nginx
{{ components.dev_test_image.imageTag }}
: contains only the image tag.
Example:latest
The context
, dockerfile
, target
and args
can be used in value interpolation contexts. For args
, especially, value interpolation is particularly useful, allowing you to use environment variables as arguments.
Resources
The DockerImage
component does not produce any deployed resources, just the container images.
Still, the Pod itself that will build the image, will run in the cluster and with the k8s resources specified in the Build Settings.
Updated 9 months ago