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

is there an alternative to copy the postgres library? #41

Open
gkwan-ibm opened this issue Feb 6, 2024 · 1 comment · May be fixed by #52
Open

is there an alternative to copy the postgres library? #41

gkwan-ibm opened this issue Feb 6, 2024 · 1 comment · May be fixed by #52

Comments

@gkwan-ibm
Copy link
Member

For the finish scenario, use mvn package to copy the required postgres library for building docker image.

is there an alternative to achieve it?

@gkwan-ibm
Copy link
Member Author

What is the best practice to copy the 3rd-party libraries during docker build? The configuration (pom.xml and Dockerfile) should fulfill the following requirements:

  • ideal pom.xml: the pom.xml should be as simplest as possible
  • the app can be run by liberty:dev and liberty:devc
  • Dockerfile can be used for production
  • Dockerfile can be used for liberty:devc
  • Dockerfile can be used for testing with testcontainers in CI/CD, i.e. run by mvn clean verify only

Solution 1: In this guide, it currently uses the maven-dependency-plugin. It can directly download the postgres library locally by mvn package, but it makes the pom.xml complicated. I like to improve it.

Solution 2: Thank you Scott to improve it by binding the create goal to prepare-package in the LMP configuration. I concern that when run the tests in CI/CD, there is an overhead to install the Liberty kenral locally just for copying the postgres library to local.

Solution 3: I tried out to use Maven docker image to download the postgres library as a staging in the Dockerfile, and copy it to the Liberty. Its pros is simpler the pom.xml, but its cons are making the Dockerfile a bit more and an overhead of downloading Maven image during build.

Is there any better idea or either of the above 3 solutions is the best practice?

Other ideas (probably unrealistic):

  • OL docker image provides mvn/mvnw command for users to download/copy 3rd libraries directly in docker build
  • OL feature provides tool (under the bin directory) to download/copy 3rd libraries
  • OL docker image provides script to download/copy 3rd libraries, like RUN features.sh, RUN configure.sh

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

Successfully merging a pull request may close this issue.

1 participant