- Configure
bootBuildImage
ingradle.build
.
bootBuildImage {
imageName = "${project.name}:${version}"
/* Uncomment below part to publish created image to docker registry.
publish = true
docker {
publishRegistry {
username = "user"
password = "secret"
url = "https://docker.example.com/v1/"
email = "user@example.com"
}
}*/
}
- Create image.
./gradlew bootBuildImage
- Run the image (specify image and tag name properly).
docker run --rm -p 8080:8080 image-creation-without-dockerfile:0.0.1-SNAPSHOT
- Publish image.
./gradlew bootBuildImage --publishImage
- Add
jib
plugin inbuild.gradle
.
id 'com.google.cloud.tools.jib' version '3.2.0'
- Configure
jib
inbuild.gradle
.
jib {
from {
image = "azul/zulu-openjdk:17-jre"
}
to {
image = "${project.name}:${version}"
}
}
- Create image.
./gradlew jibDockerBuild
- Run the image (specify image and tag name properly).
docker run --rm -p 8080:8080 image-creation-without-dockerfile:0.0.1-SNAPSHOT
- Publish image.
./gradlew jib