I have a multi-module maven project where the single modules are all runnable microservice applications containing their own Dockerfile, so in production every module will be a containerized application.
The parent project, which contains the child-modules only contains the parent pom.xml and the docker-compose.yml
I have tried to use the following Dockerfile (on sub-module level):
FROM sgrio/java-oracle
RUN apt-get update
RUN apt-get install -y maven
COPY ../pom.xml /usr/local/service/Oogaday/pom.xml
COPY pom.xml /usr/local/service/Oogaday/OogadayApi/pom.xml
COPY src /usr/local/service/Oogaday/OogadayApi/src
WORKDIR /usr/local/service/Oogaday/OogadayApi/
RUN mvn package -DskipTests
CMD ["java","-jar","org.oogaday.api-1.0-SNAPSHOT-jar-with-dependencies.jar"]
But I am getting a security error because I am trying to copy the parent pom.xml file (which is not placed in the directory from which I am running the build).
So is there a way to build a maven based sub-module with parent pom?