Skip to content

Build base - extension projects with JIB #4383

@oraad

Description

@oraad

Environment:

  • Jib version: 3.4.3
  • Build tool: Maven 3.9.6
  • OS: Linux/Ubuntu

Description of the issue:
I have a Spring Boot project that I build as base image and I a have a second project that extends the functionality of the base image. The second project is loaded as dependency in the classpath of the base project (sort of like a plugin). I built the base image with jib and I got a working image. I'm trying to use the base image to build the extension project with jib and have it packaged in a new image that run the base application

Expected behavior:
Maintain the base image structure, main class, entrypoint... while adding the extension project and its dependencies as dependency to the base image and packaged it into a new image

Steps to reproduce:

  1. Create a Spring Boot project and build it with JIB as base image
  2. Create a second project that implements a functionality from the base project and is used as a plugin by the base project
  3. Build the second project with jib with image from as base image

jib-maven-plugin Configuration:
Base Project

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>3.4.3</version>
    <configuration>
       <from>
                <image>eclispe-temurin:21-jre</image>
            </from>
        <to>
            <image>base-image</image>
        </to>
    </configuration>
    <executions>
        <execution>
            <id>installing</id>
            <phase>install</phase>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Extension Project

<plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>jib-maven-plugin</artifactId>
    <version>3.4.3</version>
    <configuration>
       <from>
                <image>base-image</image>
            </from>
        <to>
            <image>extended-image</image>
        </to>
       <container>
          <entrypoint>INHERIT</entrypoint>
       </container>
    </configuration>
    <executions>
        <execution>
            <id>installing</id>
            <phase>install</phase>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions