1 // Builds a docker container. This requires the kaniko container to be included using agentsetup
3 // Mandatory arguments:
4 // - context: the relative path in the source repository to the directory where the docker file is located
5 // - container: the name of the container to build
8 // - cache: Whether to use the cache for building containers. Defaults to true
9 // - dockerfile: Name of the docker file in the context directory. Defaults to Dockerfile
10 // - repo: Repository to publish container to. Defaults to the CONTAINER_REGISTRY environment variable
11 // - version: Container version to build. Default to the value of the BRANCH_NAME variable
17 dockerfile: 'Dockerfile',
18 repo: env.CONTAINER_REGISTRY,
19 version: env.BRANCH_NAME
21 args = defaults << args
24 echo "Building container with settings: ${args}"
25 /kaniko/executor --dockerfile ${args.dockerfile} --cache=${args.cache} --cache-ttl=${args.cachettl} --context \$( pwd )/${args.context} --destination ${args.repo}/${args.container}:${args.version}