Git Product home page Git Product logo

Comments (3)

YevheniiPokhvalii avatar YevheniiPokhvalii commented on July 23, 2024

Hi @n-g-work ,

The order of Push and Kaniko steps are not connected with the resulting .jar files that appear in the Docker image.
The Push step just deploys everything what's in the 'target' folder after the Java application build to Nexus.
In turn, the Kaniko step takes the Dockerfile commands and pushes everything to the registry according to those instructions.

You can examine our pipelines here: https://github.com/epam/edp-tekton/blob/v0.5.0/charts/pipelines-library/templates/pipelines/_common_java_maven.yaml

We intentinonaly do not include any sort of file ignores in our Pipelines and Tasks since each unique application can produce different build results.

Threre are several options to avoid unnecessary .jar files to be included into the Docker image:

  1. It's .dockerignore like you already mentioned in this issue.
  2. The COPY instruction can be modified in the Dockerfile directly.
  3. It's also possible to ingnore files via pom.xml file.

from edp-tekton.

n-g-work avatar n-g-work commented on July 23, 2024

Hi @YevheniiPokhvalii,

I can't disagree that using a .dockerignore file is a solution. I have only one problem with this.
It is considered a best practice to place .dockerignore file in the root directory of a project, and currently the pipeline ignores it in case of a Maven multimodule project.
For multimodule projects the file must be placed into the folder which corresponds to the value in the <deployable.module> tag. And exactly this file location requirement is confusing.

I would consider the issue resolved if the pipeline takes into account the .dockerignore file in the project's root directory.

from edp-tekton.

YevheniiPokhvalii avatar YevheniiPokhvalii commented on July 23, 2024

@n-g-work I see your point.

I experimented a little bit and came up with two solutions.

  1. Use Dockerfile.dockerignore instead of .dockerignore with this content:
target/*-sources.jar

This file is picked up by the Kaniko runtime along with the path to the Dockerfile.

  1. The second solution is to modify java-maven-springboot-multimodule-impl/pom.xml and add a custom output folder like it's described here: https://maven.apache.org/plugins/maven-source-plugin/examples/configureplugin.html
              <configuration>
                <outputDirectory>target/sources</outputDirectory>
              </configuration>

Feel free to check this example: https://github.com/epmd-edp/java-maven-java17-multimodule

from edp-tekton.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.