I have the following...
id 'com.google.cloud.tools.jib' version '3.1.4'
...
jib {
from {
image = 'amazoncorretto:20'
}
to {
image = 'cbusha-backend:latest'
}
}
This allows me to build and store the image locally. Now I want another "profile" or task where if I provide a flag it deploys to AWS ECR. This works if I manually change it like this...
jib {
from {
image = 'amazoncorretto:20'
}
to {
image = '660315312345.dkr.ecr.us-east-2.amazonaws.com/cbusha-backend:latest'
}
}
I don't want to upload to ECR until I have tested locally. How would I configure Gradle to handle this?
There are really many different ways to achieve this goal, but how about using a simple property?
or
See https://blog.mrhaki.com/2016/05/gradle-goodness-get-property-or-default.html to understand Gradle properties.