plugins {
    id "com.google.cloud.tools.jib"
}

jib {
    configurationName = "productionRuntimeClasspath"
    from {
        image = "eclipse-temurin:17-jre-focal"
        platforms {
            platform {
                architecture = "${findProperty('jibArchitecture') ?: 'amd64'}"
                os = "linux"
            }
        }
    }
    to {
        image = "smartbooking:latest"
    }
    container {
        entrypoint = ["bash", "-c", "/entrypoint.sh"]
        ports = ["8080"]
        environment = [
            SPRING_OUTPUT_ANSI_ENABLED: "ALWAYS",
            JHIPSTER_SLEEP: "0"
        ]
        creationTime = "USE_CURRENT_TIMESTAMP"
        user = 1000
    }
    extraDirectories {
      paths = file("src/main/docker/jib")
      permissions = ["/entrypoint.sh": "755"]
    }
}