-
Notifications
You must be signed in to change notification settings - Fork 539
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
NullpointerException with multistage Dockerfile #2100
Comments
@rhierlmeier : I think you're getting NPE because you haven't provided any assembly name. Does the error go away when you add assembly name like this? <assembly>
<name>maven</name>
<mode>dir</mode> Maybe we can assume assembly name as default assembly name if it's not provided. |
@rhierlmeier : Is it possible to provide more information about the project you're using? Which version of spring boot? What packaging strategy are you using etc? I'm able to get over NPE by adding assembly name but I run into a different error (seems related to my reproducer project setup):
|
Looking at the code we're already handling empty/null fields in assembly by providing defaults here: We invoke this method here to create AssemblyConfiguration: However, while checking whether Dockerfile uses assembly we're using wrong object (we're checking assembly inside I'm able to no longer see NPE after passing assemblyConfig here. |
… references in Dockerfile (eclipse-jkube#2100) We're already seem to process AssemblyConfiguration before creating docker tar archives. However, we're passing wrong object as AssemblyConfiguration while verifying Dockerfile actually contains ADD/COPY references to specified assembly. Add a new parameter to AssemblyManager.verifyAssemblyReferencedInDockerfile method to provide already processed AssemblyConfiguration object rather than using AssemblyConfiguration from BuildConfiguration. Signed-off-by: Rohan Kumar <[email protected]>
Ok, I the problem was that the assembly in the pom.xml has not name element.
I had to add the following line to the Dockerfile:
Can you please improve the documentation at https://www.eclipse.org/jkube/docs/kubernetes-maven-plugin/#build-assembly-layer? I think the relationship between the assembly in the pom.xml and the COPY statement in the Dockerfile is missing |
I found also out that the assembly in pom.xml is not necessary at all. Because the build process provides already the application jar in the maven directory. The following setup is enough: <groupId>org.eclipse.jkube</groupId>
<artifactId>kubernetes-maven-plugin</artifactId>
<configuration>
<images>
<image>
<build>
<dockerFile>${project.basedir}/src/main/docker/Dockerfile</dockerFile>
</build>
</image>
</images>
</configuration> And the Dockerfile:
|
… references in Dockerfile (eclipse-jkube#2100) We're already seem to process AssemblyConfiguration before creating docker tar archives. However, we're passing wrong object as AssemblyConfiguration while verifying Dockerfile actually contains ADD/COPY references to specified assembly. Add a new parameter to AssemblyManager.verifyAssemblyReferencedInDockerfile method to provide already processed AssemblyConfiguration object rather than using AssemblyConfiguration from BuildConfiguration. Signed-off-by: Rohan Kumar <[email protected]>
… references in Dockerfile (#2100) We're already seem to process AssemblyConfiguration before creating docker tar archives. However, we're passing wrong object as AssemblyConfiguration while verifying Dockerfile actually contains ADD/COPY references to specified assembly. Add a new parameter to AssemblyManager.verifyAssemblyReferencedInDockerfile method to provide already processed AssemblyConfiguration object rather than using AssemblyConfiguration from BuildConfiguration. Signed-off-by: Rohan Kumar <[email protected]>
Describe the bug
When a Multistage-Dockerfile contains a
COPY --from...
statement then the kubernetes-maven-plugin:build goal produces this exception:Eclipse JKube version
1.11.0
Component
Kubernetes Maven Plugin
Apache Maven version
3.8.5
Gradle version
None
Steps to reproduce
Configuration of the kubernetes-maven-plugin-Plugin:
Here is the Dockerfile:
Expected behavior
The kubernetes-maven-plugin must not produce an NPE because the Dockerfile is valid.
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3
Environment
Windows
Eclipse JKube Logs
No response
Sample Reproducer Project
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: