Docker Image Components

Introduction

Docker Image Components are ideal in situations where you don't already have your images built and ready to be used. Defining such a component will enable Bunnyshell to build your images for you automatically.

Docker Image components are not displayed in the main user interface. They can be defined and edited only with the env.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 version

  • name: the name

  • gitRepo: 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.

circle-exclamation

Value Interpolation

The images can be used in other components using the following interpolations:

  • {{ components.dev_test_image.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.

Last updated

Was this helpful?