Dockerizing a Multi-module Maven Application?

  docker, java, maven, pom.xml

I have a Maven Java Application that I am trying to dockerize. I have the following dockerfile so far that I have got from this answer.

#
# Build stage
#
FROM maven:3.6.0-jdk-11-slim AS build
COPY src /home/app/src
COPY pom.xml /home/app
RUN mvn -f /home/app/pom.xml clean install

# Expose the ports we're interested in
EXPOSE 8080 9990

COPY --from=build /usr/src/app/target/helloworld-1.0.0-SNAPSHOT.jar /opt/jboss/jboss-eap-6.2/standalone/deployments/

This would be fine if my application was a single module project, however because it is multi-module I assume that I cannot just use COPY src /home/app/src ?

How can I change my dockerfile to account for my multi-module project?

Source: Docker Questions

LEAVE A COMMENT