Skip to content

Docker Build

Docker Image SizeLicenseGit Repository

Builds and publishes Docker images.

The step performs a test by default to check if an image with the requested tag already exists. This prevents accidental overwriting of existing images.

The test can either be performed by checking the image's manifest (default), which doesn't require the image to be downloaded, or by performing a pull.

Params

ParamDescription
DOCKER_LOGIN_REGISTRIESSpace separated list of Docker registries to log in to (user:password@registry) (string)
NAMEImage name required (string)
TAGImage tag (string)
FILEDockerfile name (use - for STDIN) (string | "-")
CONTEXTContext directory (relative to project root) (default: .) (string)
BUILD_ARGSSpace separated list of ARG=VALUE pairs (or just ARG to refer to params directly) - params can be resolved as variables (ARG=$MY_PARAM or MY_PARAM) (string)
NETWORKNetworking mode for RUN instructions during build (default: default) (string)
USE_CACHEWhether to use the build cache (default: true) ("true" | "false")
PLATFORMPlatform to be used if the server is multi-platform capable (string)
PULLWhether to attempt to pull a newer version of the image (default: missing) ("always" | "missing")
SQUASHWhether to squash newly built layers into a single new layer (default: false) ("true" | "false")
PUSHWhether to push the newly built image (default: true) ("true" | "false")
PUSH_LATESTWhether to also push the newly built image with latest tag (default: true) ("true" | "false")
TESTWhether to test for an existing image (default: true) ("true" | "fail" | "false")
TEST_PULLWhether to perform a pull for testing for an existing image (default: false) ("true" | "false")
RESULT_VARName of a runtime variable for setting the step result ("failure" | "exists" | "success") to (string)

Trust

This step requires access to the Docker socket. See Trusted Tasks for more information.