I would like to be able to simply add an additional file (an executable) to the OCI image generated by the Spring Boot Cloud Native Buildpacks.

I currently use Jib with extraDirectories to add the executable, but I would like to switch to using Spring Boot Buildpacks to take advantage of features such as CDS.

When searching for solutions I found suggestions to either create a version of the run image with the executable included, or to have another build step run after bootBuildImage to add the executable. Neither of these are easy to integrate.

When researching Cloud Native Buildpacks I came across the concept of image extensions.

It seems to me that adding support for extensions would allow simple enhancement of the image built. I would see the addition of an extensions configuration.

tasks.named('bootBuildImage') {
    extensions = [
           "file:///path/to/example-extension.tgz"
    ]
}

This would add --extension arguments to the pack invocation.

The Maven plugin would have similar configuration

<configuration>
    <image>
        <extensions>
            <extension>file:///path/to/example-extension.tgz</extension>
        </extensions>
    </image>
</configuration>

I believe that I could then add the executable using a simple extension which would use run.Dockerfile to add the file.

├── example
    ├── extension.toml
    ├── detect
    │   ├── plan.toml
    ├── generate
    │   ├── run.Dockerfile

Comment From: scottfrederick

This is a duplicate of #41353 (although with a better description of why this is useful).

This would add --extension arguments to the pack invocation.

Note that the Spring Boot plugins do not invoke pack, but implement the same CNB platform spec that pack does.

Comment From: nwholloway

I had failed to find your issue. Closing this one.

Comment From: wilkinsona

Thanks, @scottfrederick!