This is my Dockerfile:
FROM openjdk:17
COPY ./out/production/Company /tmp
WORKDIR /tmp
ENTRYPOINT ["java","Main"]
When I run the Dockerfile I get errors because my project is using a Maven dependency: org.json
I need help editing my Dockerfile to include this Maven dependency
2
Answers
I ended up just making my maven project into a jar file and that fixed the dependency problem.
My Dockerfile looks like this:
There are multiple solutions so I gave the first response as the answer because I would have used the plugin if not for the jar solution.
The easiest way then for you is to use the
jib
plugin.Add the plugin to your project, then create an
entrypoint.sh
that tells Docker how to start the app.Then execute the plugin to build the Docker image. It will figure out all the dependencies and bundle it into the Docker image.
Link: https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin