from: <image[:<tag>]>
fromLatest: <bool>
fromCacheVersion: <arbitrary string>
fromImage: <image name>
fromImageArtifact: <artifact name>

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 fromImageArtifact directive.

from, fromLatest

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 stages 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

Pay attention, werf uses actual base image digest as extra from stage dependency if fromLatest is true. Therefore, using this directive implies not reproducible signatures: after changing base image in repository, all previously built stages, also like related images, become not usable. The problem might occur:

  • between jobs of one pipeline (e.g. build and deploy) or
  • when you rerun the previous job (e.g. deploy)

fromImage and fromImageArtifact

Besides using docker image from a repository, the base image can refer to image or artifact, that is described in the same werf.yaml.

fromImage: <image name>
fromImageArtifact: <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 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.

fromCacheVersion

The fromCacheVersion directive allows to manage image reassembly.

fromCacheVersion: <arbitrary string>