com.bmuschko.gradle.docker.tasks.image.DockerBuildImage.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-docker-plugin Show documentation
Show all versions of gradle-docker-plugin Show documentation
Gradle plugin for managing Docker images and containers.
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bmuschko.gradle.docker.tasks.image
import com.bmuschko.gradle.docker.DockerRegistryCredentials
import com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask
import com.bmuschko.gradle.docker.tasks.RegistryCredentialsAware
import com.github.dockerjava.api.DockerClient
import com.github.dockerjava.api.command.BuildImageCmd
import com.github.dockerjava.api.model.AuthConfig
import com.github.dockerjava.api.model.AuthConfigurations
import com.github.dockerjava.api.model.BuildResponseItem
import com.github.dockerjava.core.command.BuildImageResultCallback
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
class DockerBuildImage extends AbstractDockerRemoteApiTask implements RegistryCredentialsAware {
/**
* Input directory containing the build context. Defaults to "$buildDir/docker".
*/
@InputDirectory
@PathSensitive(PathSensitivity.RELATIVE)
final DirectoryProperty inputDir = newInputDirectory()
/**
* The Dockerfile to use to build the image. If null, will use 'Dockerfile' in the
* build context, i.e. "$inputDir/Dockerfile".
*/
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
@Optional
final RegularFileProperty dockerFile = newInputFile()
/**
* Tags for image.
*/
@Input
@Optional
final SetProperty tags = project.objects.setProperty(String)
@Input
@Optional
final Property noCache = project.objects.property(Boolean)
@Input
@Optional
final Property remove = project.objects.property(Boolean)
@Input
@Optional
final Property quiet = project.objects.property(Boolean)
@Input
@Optional
final Property pull = project.objects.property(Boolean)
@Input
@Optional
final Property