title: Docker-compose - build with maven that re-uses the maven repository
body: <p>When building my Spring-boot image using Maven I now do this inside the Dockerfile. Maven will download all dependencies and then compile my files. This takes quite some time. </p>
  
  <p>How can I specify that the build process via docker-compose (Dockerfile) re-uses my "Windows10 Home" Maven repository? So, the number of (new) downloads is minimal. My dev context: I use the Docker quickstart terminal, so using a docker-machine. </p>
  
  <p>The is is a part of my docker-compose.yml file: </p>
  
  <pre><code>version: '3'
  services:
    spring-boot-app:
      image: spring-boot-image
      build:
        context: ./
        dockerfile: Dockerfile
      depends_on:
        - mysql-docker-container
      ports:
        - 8087:8080
      volumes:
        - $HOME/.m2/repository:/root/.m2/repository
        - /data/spring-boot-app
  </code></pre>
  
  <p>My Dockerfile is: </p>
  
  <pre><code>FROM java:8
  FROM maven:alpine
  WORKDIR /app
  COPY . /app
  RUN mvn -v
  RUN mvn clean install -DskipTests
  EXPOSE 8080
  LABEL maintainer=“xyz@holland.nl”
  ADD ./target/spring-boot-example-0.0.1-SNAPSHOT.jar /developments/
  ENTRYPOINT ["java","-jar","/developments/spring-boot-example-0.0.1-SNAPSHOT.jar"]
  </code></pre>