Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Efficient Container Images" like Spring Boot does? #1843

Open
jakub-bochenski opened this issue Dec 13, 2024 · 1 comment
Open

"Efficient Container Images" like Spring Boot does? #1843

jakub-bochenski opened this issue Dec 13, 2024 · 1 comment

Comments

@jakub-bochenski
Copy link
Contributor

jakub-bochenski commented Dec 13, 2024

https://docs.spring.io/spring-boot/reference/packaging/container-images/efficient-images.html#packaging.container-images.efficient-images.layering

dependencies (for regular released dependencies) 

snapshot-dependencies (for snapshot dependencies)

application (for application classes and resources)

The bundled resource descriptors aren't really able to do this for a multi-module project.
E.g. dependency descriptor will treat all other project modules as external dependencies.

I'm using this currently (as I don't care about snapshots):

<assemblies>
    <assembly>
        <name>application</name>
        <inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
            <dependencySets>
                <dependencySet>
                    <useProjectArtifact>true</useProjectArtifact>
                    <includes>
                        <include>${project.groupId}:*</include>
                    </includes>
                </dependencySet>
            </dependencySets>
        </inline>
    </assembly>
    <assembly>
        <name>dependencies</name>
        <inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
            <dependencySets>
                <dependencySet>
                    <excludes>
                        <exclude>${project.groupId}:*</exclude>
                    </excludes>
                    <scope>runtime</scope>
                </dependencySet>
            </dependencySets>
        </inline>
    </assembly>
</assemblies>

It's relying on all modules in the project belonging to the same group, which is a common convention.

It would be nice if d-m-p provided bundled descriptors to handle this

@jakub-bochenski
Copy link
Contributor Author

to clarify: I don't want to use Spring Boot, I just want to create layers in similar fashion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant