use of com.bmuschko.gradle.docker.DockerJavaApplication in project curiostack by curioswitch.
the class CurioServerPlugin method apply.
@Override
public void apply(Project project) {
project.getPluginManager().apply(ApplicationPlugin.class);
project.getPluginManager().apply(GitPropertiesPlugin.class);
project.getExtensions().create(ImmutableDeploymentExtension.NAME, DeploymentExtension.class, project);
project.getNormalization().getRuntimeClasspath().ignore("git.properties");
project.afterEvaluate(p -> {
ImmutableDeploymentExtension config = project.getExtensions().getByType(DeploymentExtension.class);
String archivesBaseName = project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
project.getConvention().getPlugin(ApplicationPluginConvention.class).setApplicationName(archivesBaseName);
GroovyObject docker = project.getExtensions().getByType(DockerExtension.class);
DockerJavaApplication javaApplication = (DockerJavaApplication) docker.getProperty("javaApplication");
javaApplication.setBaseImage("openjdk:9-jre-slim");
project.getTasks().getByName("build").dependsOn("dockerDistTar");
for (ImmutableDeploymentConfiguration type : config.getTypes()) {
String capitalized = Ascii.toUpperCase(type.getName().charAt(0)) + type.getName().substring(1);
DeployConfigMapTask deployConfigMapTask = project.getTasks().create("deployConfigMap" + capitalized, DeployConfigMapTask.class).setType(type.getName());
project.getTasks().create("deploy" + capitalized, DeployPodTask.class).setType(type.getName()).dependsOn(deployConfigMapTask);
}
});
project.getPluginManager().apply(DockerJavaApplicationPlugin.class);
}
Aggregations