title | permalink | author | directive_summary |
---|---|---|---|
Base image |
usage/build_draft/stapel/base.html |
Alexey Igrychev <alexey.igrychev@flant.com> |
base_image |
Here's a minimal werf.yaml
. It describes a image named example
that is based on a base image named alpine
:
project: my-project
configVersion: 1
---
image: example
from: alpine
Base image can be declared with from
, fromImage
or fromArtifact
directive.
The from
directive defines the name and tag of a base image. If absent, tag defaults to latest
.
from: <image>[:<tag>]
By default, the assembly process does not depend on actual base image digest in the repository, only on from directive value. Thus, changing base image locally or in the repository does not matter if from stage is already exists in storage.
If you want always build the image with actual base image you should use fromLatest directive. fromLatest directive allows connecting the assembly process with the base image digest getting from the repository.
fromLatest: true
By default, the use of the
fromLatest
directive is not allowed by giterminism (read more about it [here]({{ "usage/project_configuration/giterminism.html" | true_relative_url }}))
Besides using docker image from a repository, the base image can refer to image or [artifact]({{ "usage/build_draft/stapel/imports.html#what-is-an-artifact" | true_relative_url }}), that is described in the same werf.yaml
.
fromImage: <image name>
fromArtifact: <artifact name>
If a base image is specific to a particular application, it is reasonable to store its description with images and artifacts which are used it as opposed to storing the base image in a container registry.
Also, this method can be useful if the stages of stage conveyor are not enough for building the image. You can design your stage conveyor.
<a class="google-drawings" href="{{ "images/configuration/base_image2.png" | true_relative_url }}" data-featherlight="image"> <img src="{{ "images/configuration/base_image2_preview.png" | true_relative_url }}" alt="Conveyor with fromImage and fromArtifact stages">
The fromCacheVersion
directive allows managing image reassembly.
fromCacheVersion: <arbitrary string>