/*
 * Copyright (c) 2019 Red Hat, Inc.
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at:
 *
 *     https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *   Red Hat, Inc. - initial API and implementation
 */

buildscript {
    repositories {
        mavenLocal()
    }
    dependencies {
        classpath('org.eclipse.jkube.quickstarts.kit:foo-generator:1.8.0-SNAPSHOT')
    }
}

plugins {
    id 'org.eclipse.jkube.kubernetes' version '1.18.1'
    id 'org.eclipse.jkube.openshift' version '1.18.1'
    id 'java'
}

group = 'org.eclipse.jkube.quickstarts.kit'
version = '0.0.1-SNAPSHOT'

repositories {
    mavenLocal()
}

jar {
    manifest {
        attributes(
                "Main-Class": "org.eclipse.jkube.quickstarts.kit.Greeting"
        )
    }
}

kubernetes {
    offline = true
    generator {
        includes = ['foo']
    }
    images {
        image {
            name = "jkube/${project.name}:${project.version}"
            alias = "foo-app"
            build {
                from = "quay.io/jkube/jkube-java:0.0.13"
                assembly {
                    targetDir = "/deployments"
                    layers = [{
                        fileSets = [{
                              directory = file("${project.rootDir}/build/libs")
                        }]
                    }]
                }
            }
        }
    }
}

openshift {
    offline = true
    generator {
        includes = ['foo']
    }
    images {
        image {
            name = "jkube/${project.name}:${project.version}"
            alias = "foo-app"
            build {
                from = "quay.io/jkube/jkube-java:0.0.13"
                assembly {
                    targetDir = "/deployments"
                    layers = [{
                                  fileSets = [{
                                                  directory = file("${project.rootDir}/build/libs")
                                              }]
                              }]
                }
            }
        }
    }
}

