Image

Define the Docker images you want to build

Stevedore represents a Docker image by an image definition, therefore an image holds the details required to build that image. Note that an image by itself has no sense, it must be defined within the images-tree.

Keywords reference

KeywordTypeDescriptionValue
builderstring/mapIdentifies the builder to use to create the image.
You can define it as a string when you want to refer to a global-builder already defined.
To designate it such an in-line builder, you must define it as a yaml data-structure. In the builder’s reference guide you find the details to define it.
If the builder attribute is not defined, it is used a builder which does not perform actions.
-
childrenmapIt is a map where each key refers to an image within the images-tree and the value is a list of image versions.-
namestringIt is the image name.By default its value is defined as the images-tree’s image name key
namespacestringIt is the Docker`s registry namespace.-
persistent_varsmapYou define there a list of variables required to build the Docker image. That variables are inherit by the children images.Its value is a key-value data-structure where each key is an string and its value a yaml data-structure.
registrystringIt is the Docker’s registry host.-
tagslistYou define a list of additional tags to generate.-
varsmapYou define there a list of variables required to build the Docker image.Its value is a key-value structure where each key is an string and its value a yaml data-structure.
versionstringIt is the Docker’s image tag.By default its value is defined as the images-tree’s image version key
  • Example
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    name: ubuntu
    version: 18.04
    builder:
      driver: docker
      options:
      	context:
    	  path: ./ubuntu
    namespace: stable
    registry: myregistry.example.com
    tags:
      - latest
    persistent_vars:
      ubuntu_version: 18.04
    vars:
      os_base: rootfs.tar
    children:
      app1:
        - "1.2.3"
        - "*"
      app2:
        - "0.3.1"
        - "*"

Templating image attributes

An image definition allows you to define the values of its attributes as a Golang text template.

To achieve that, Stevedore provides you with the next template variables, which refer to values from the images-tree.

NameTemplateDescription
name{{ .Name }}It provides the image’s name within the images-tree
version{{ .Version }}It provides the image’s version within the images-tree
parent{{ .Parent }}It let you to achieve the templating image attributes from the parent image.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
name: ubuntu
version: "{{ .Version }}"
builder:
  driver: docker
  options:
  	context:
	  path: ./ubuntu
namespace: stable
registry: myregistry.example.com
tags:
  - "{{ .Version }}-{{ .Parent.Version }}"
persistent_vars:
  ubuntu_version: "{{ .Version }}"
Last modified March 26, 2023: change header image (ef70c3b)