Quantcast
Channel: Docker-compose - build with maven that re-uses the maven repository - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Docker-compose - build with maven that re-uses the maven repository

$
0
0

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.

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.

The is is a part of my docker-compose.yml file:

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

My Dockerfile is:

FROM java:8FROM maven:alpineWORKDIR /appCOPY . /appRUN mvn -vRUN mvn clean install -DskipTestsEXPOSE 8080LABEL 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"]

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images