I have a Java
project that builds a jar
file that is then ran on a Jboss EAP
server. The jar
file is built using the maven command:
mvn clean install
Currently I am building the jar
manually using maven
then adding it to my dockerfile
as follows:
# rest of dockerfile...
EXPOSE 8080 9990
ADD app.jar "/opt/jboss/jboss-eap-6.2/standalone/deployments/"
RUN ["chmod", "+rx", "/opt/jboss/jboss-eap-6.2/"]
ENTRYPOINT ["sh","/opt/jboss/jboss-eap-6.2/bin/standalone.sh"]
How can I add the maven
command into my dockerfile
so that a developer does not need to install maven and build it themselves first?
i.e. the steps will just be:
1. checkout the code from git
2. run dockerfile
I think the best approach is to use a multi stage build similar to what is suggested here? However I am not sure how to implement this.