I am trying to create a Docker file to create a Maven project.
I wonder how to fix the Docker file and what command to execute.
I would like to know how to run the assembly so that it does NOT load all Maven dependencies every time it is built, when the source code located in the src / directory has NOT changed.
Here is my Dockerfile:
FROM maven:3.3.9-jdk-8
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
RUN cd /usr/src/app
ADD pom.xml /usr/src/app
RUN mvn dependency:resolve
ADD src /usr/src/app
RUN mvn package
ENTRYPOINT ["mvn"]
CMD ["package"]
Should I run a team docker run --rm -it toolboxor team docker build -t toolbox .?
Both of these commands work fine, except that they both download all Maven dependencies, even if the source code has not been affected.
source
share