plugins {
    id 'java'
    id 'org.springframework.boot' version '2.7.12'
    id 'io.spring.dependency-management' version '1.1.0'
    id 'com.google.cloud.tools.jib' version '3.2.0'
}

group = 'com.challenge'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

jib {
    from {
        image = 'openjdk:17.0.1-jdk-slim'
    }
    to {
        image = 'chat-challenge'
        tags = ['0.9']
    }
    container {
        mainClass = 'com.challenge.chat.ChatApplication'
        creationTime = 'USE_CURRENT_TIMESTAMP'
        jvmFlags = ['-Dspring.profiles.active=dev']
        format = 'OCI'
        volumes = ['/var/temp']
//        entrypoint = ['java', '-cp', '/app/resources:/app/classes:/app/libs/*'
//        , 'com.challenge.chat.ChatApplication']
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-websocket'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.projectlombok:lombok:1.18.26'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
    implementation 'com.auth0:java-jwt:4.2.1'
    implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3'
    runtimeOnly 'com.h2database:h2'

    implementation 'org.webjars:stomp-websocket:2.3.3'

    //mysql
    runtimeOnly 'com.mysql:mysql-connector-j'

    // MongoDB
    implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'

    // Kafka
    implementation 'org.springframework.kafka:spring-kafka'
    implementation 'org.apache.kafka:kafka-clients'
    testImplementation 'org.springframework.kafka:spring-kafka-test'

    //Prometheus
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'io.micrometer:micrometer-core'
    implementation 'io.micrometer:micrometer-registry-prometheus'

    //RabbitMQ
// https://mvnrepository.com/artifact/org.springframework.amqp/spring-rabbit
//    implementation 'org.springframework.boot:spring-boot-starter-amqp:2.6.4'
//    implementation 'org.springframework.boot:spring-boot-starter-reactor-netty:2.6.4'

    // Elasticsearch
    implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'
}

tasks.named('test') {
    useJUnitPlatform()
}
