GoogleContainerTools / jib-extensions

Apache License 2.0
117 stars 35 forks source link

For jib-native-image-extension-gradle what default container image is used? And how can it be overridden? #138

Closed haroldlbrown closed 1 year ago

haroldlbrown commented 1 year ago

Spring Boot 3 will be released in November 2022. It will feature support for GraalVM Native Images.

I am trying to build a Native Image with Spring Boot 3 Milestone 5 and the jib-native-image-extension-gradle extension.

According to the extension's documentation, the extension copies the Native Image binary into a container image.

However, I can't find out which container image will be used. Also, I can't find out how to override the default container image.

What is the default container image that the jib-native-image-extension-gradle extension uses and how can it be overridden?

mpeddada1 commented 1 year ago

Hey @haroldlbrown To configure container image specs, you can still do that through the jib task. Here is the link to the readme that describes how the container image name can be set. You may also find the Gradle instructions for Jib extensions to be useful. If you're building to the docker daemon by calling jibDockerBuild without specifying a name, it should be the same as the imageName you've specified in the properties section of the jib-native-image-extension-gradle settings. Look for the Built image to Docker daemon as [container image name] line in your logs.

haroldlbrown commented 1 year ago

Hi @mpeddada1. Thank you for your quick response.

I was not talking about the Docker image name for the Docker image that is created by the jib-native-image-extension-gradle extension.

I was talking about the Docker image that the jib-native-image-extension-gradle extension uses to copy the GraalVM Native Image into.. Is this by default for example a debian:latest Docker image? Or an ubuntu:latest Docker image? And how can I override which Docker image is used for copying the GraalVM Native Image into?

M-Whitaker commented 1 year ago

Hi, that would be configured using jib plugin not the extension. There is some config tags that define the ‘from’ that we then copy the binary into. This can be found in the documentation here:
https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/README.md

The extract is something like this:

jib {
            from {
                image = "eclipse-temurin:17.0.4.1_1-jre"
                platforms {
                    platform {
                        os = "linux"
                        architecture = "yourarchhere"
                    }
                }
            }
            to {
                image = "registry.example.com/example/outputimage:tag
        }
} 
haroldlbrown commented 1 year ago

Hi, @M-Whitaker.

Thank you very much for the clarification. 🙇‍♂️