Skip to content

Latest commit

 

History

History
240 lines (171 loc) · 5.21 KB

docker.image.build.rst

File metadata and controls

240 lines (171 loc) · 5.21 KB

docker.image.build

Hook Path

runway.cfngin.hooks.docker.image.build

Docker image build hook.

Replicates the functionality of the docker image build CLI command.

1.18.0

Args

docker

Options for docker image build.

buildargs

Dict of build-time variables.

custom_context

Optional if providing a path to a zip file.

extra_hosts

Extra hosts to add to /etc/hosts in the building containers. Defined as a mapping of hostname to IP address.

forcerm

Always remove intermediate containers, even after unsuccessful builds.

isolation

Isolation technology used during build.

network_mode

Network mode for the run commands during build.

nocache

Don't use cache when set to True.

platform

Set platform if server is multi-platform capable. Uses format os[/arch[/variant]].

pull

Download any updates to the FROM image in the Dockerfile.

rm

Remove intermediate containers.

squash

Squash the resulting image layers into a single layer.

tag

Optional name and tag to apply to the base image when it is built.

target

Name of the build-stage to build in a multi-stage Dockerfile.

timeout

HTTP timeout.

use_config_proxy

If True and if the docker client configuration file (~/.docker/config.json by default) contains a proxy configuration, the corresponding environment variables will be set in the container being built.

dockerfile

Path within the build context to the Dockerfile.

ecr_repo

Information describing an ECR repository. This is used to construct the repository URL. If providing a value for this field, do not provide a value for repo.

If using a private registry, only repo_name is required. If using a public registry, repo_name and registry_alias.

account_id

AWS account ID that owns the registry being logged into. If not provided, it will be acquired automatically if needed.

aws_region

AWS region where the registry is located. If not provided, it will be acquired automatically if needed.

registry_alias

If it is a public repository, provide the alias.

repo_name

The name of the repository.

path

Path to the directory containing the Dockerfile.

repo

URI of a non Docker Hub repository where the image will be stored. If providing one of the other repo values, leave this value empty.

tags

List of tags to apply to the image.

Returns

type

~runway.cfngin.hooks.docker.hook_data.DockerHookData

description

The value of item image in the returned object is set to the ~runway.cfngin.hooks.docker.data_models.DockerImage that was just created.

The returned object is accessible with the hook_data Lookup <hook_data lookup> under the data_key of docker (do not specify a data_key for the hook, this is handled automatically).

Important

Each execution of this hook overwrites any previous values stored in this attribute. It is advices to consume the resulting image object after it has been built, if it will be consumed by a later hook/stack.

Example

pre_deploy:
  - path: runway.cfngin.hooks.docker.login
    args:
      ecr: true
      password: ${ecr login-password}
  - path: runway.cfngin.hooks.docker.image.build
    args:
      ecr_repo:
        repo_name: ${cfn ${namespace}-test-ecr.Repository}
      tags:
        - latest
        - python3.9
  - path: runway.cfngin.hooks.docker.image.push
    args:
      image: ${hook_data docker.image}