com.netflix.gradle.plugins.docker.SystemPackageDockerfile.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-ospackage-plugin Show documentation
Show all versions of gradle-ospackage-plugin Show documentation
Provides a task similar to Tar and Zip for constructing RPM and DEB package files.
package com.netflix.gradle.plugins.docker
import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction
import com.netflix.gradle.plugins.packaging.SystemPackagingTask
import org.gradle.tooling.model.UnsupportedMethodException
import org.gradle.work.DisableCachingByDefault
@DisableCachingByDefault
class SystemPackageDockerfile extends SystemPackagingTask {
private final DockerfileInstructionManager dockerfileInstructionManager
private static final ARCHIVE_NAME = 'Dockerfile'
SystemPackageDockerfile() {
dockerfileInstructionManager = new DockerfileInstructionManager()
}
@Override
String assembleArchiveName() {
ARCHIVE_NAME
}
@Override
AbstractPackagingCopyAction createCopyAction() {
new DockerCopyAction(this, dockerfileInstructionManager)
}
@Override
String getArchString() {
throw new UnsupportedMethodException('The architecture is defined through FROM instruction in Docker images')
}
void instruction(String instruction) {
dockerfileInstructionManager.addInstruction(instruction)
}
}