Creating a container with JIB

47 Views Asked by At

I have used docker and hosted to GCP. I wanted to try out JIB. Everywhere it says No Docker file, No Docker Desktop to be run to generate a container. But this doesn't seem to be working at all.

I use Gradle-9 and JDK 21.0.2

On build. gradle I have included

Plugin{ id 'com.google.cloud.tools.jib' version '3.4.0' }
jib{
   from: { What Should I add here? }
     to: { How do I send it to my Artifact Registery in GCP }
}

I tried several examples and StackOverflow Q&A, but nothing seemed helpful to answer what is to be added for the FROM and TO properly.

1

There are 1 best solutions below

0
Manoj On BEST ANSWER

This worked for me.

jib {

    from {
        image = 'openjdk:23-jdk-oracle'
    }
    to {
        image = 'location to GCP artifact registry repo'
    }
}

Docker account should be logged in via terminal. Only then this works.