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

Turning on JIB mode breaks multi-assembly images #1770

Open
stengerh opened this issue Mar 11, 2024 · 2 comments
Open

Turning on JIB mode breaks multi-assembly images #1770

stengerh opened this issue Mar 11, 2024 · 2 comments
Assignees

Comments

@stengerh
Copy link

Description

JIB mode has some unexpected effects which cause the image to not run. The image build itself runs fine. In particular this can break images which work just fine by switching to JIB mode.

Closer inspection of the image (using e. g. docker inspect, docker history or dive reveals that the image is a strange mix between the intended image (build with JIB mode off) and the docker-build.tar containing the build context, in particular:

  • <targetDir> is ignored, instead the assembly name is used as path in the container. This is the main breaking issue since the paths given in <entrypoint> or <cmd> no longer apply.
  • The image contains an extra layer with just the Dockerfile in it.
  • The order of layers is changed.
  • The number of layers is multiplied: If there are N assemblies the build adds N * (N + 1) layers to the base image, i. e. there are N copies of each layer. The layers are only duplicated in the image manifest since their contents are identical.

Info

  • docker-maven-plugin version : 0.44.0
  • Maven version (mvn -v) :
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
  • Docker version : 24.0.5
  • If it's a bug, how to reproduce :

Take the multi-assembly project from the plugin's examples or integration tests and turn on JIB mode.

The link actually leads to a fix I've been working on. I am aware that it does not yet meet all of requirements from the contribution guidelines. It at least needs sign-off and squashing.

@rohanKanojia
Copy link
Member

@stengerh : Thanks for reporting this! I see you're working on fixing the issue. Shall I assign it to you then?

@stengerh
Copy link
Author

@rohanKanojia : Yes, please do!

My branch currently contains an enhancement to explicitly configure the output filename for the image archive. It made the configuration for integration tests more pleasant to look at. However, I feel this feature should go into its own PR since it will probably require some discussion.

So far I have built the plugin and its integration tests locally. I plan to submit an initial PR by the end of the week to get some feedback.

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

2 participants