title: Execute mvn clean install before docker-compose commands
body: <p>I am running multiple spring-boot microservice within docker containers.
  I am writing docker-compose.yml file to automate de deploy, but I have a problem.
  All the spring-boot microservices have different profiles depending on if you want to run them locally without docker and another ig you want to run them with docker (Basically each profiles changes the URls of clients between microservices).</p>
  
  <p>If I run docker-compose up and the jar files that have been compiled are not compiled with "docker" spring-boot profile, it will creates the images with the wrong jar.</p>
  
  <p>MY DOCKER-COMPOSE.YML EXAMPLE:</p>
  
  <pre><code>version: "3"
  
  services:
    imageserver:
      build:
        context: ./ImageServer
        dockerfile: Dockerfile
      ports:
        - 8081:8081
      networks:
        - my-private-network
    core:
      build:
        context: ./Core
        dockerfile: Dockerfile
      ports:
        - 8082:8082
      networks:
        - my-private-network
  
  networks:
    my-private-network:
    my-public-network
  </code></pre>
  
  <p>ONE OF MY DOCKERFILE EXAMPLE:</p>
  
  <pre><code>FROM openjdk:8-jdk-alpine
  LABEL maintainer="lalala@gmail.com"
  VOLUME /tmp
  EXPOSE 8082
  COPY ./target/*.jar Core.jar
  ENTRYPOINT ["java","-jar","/Core.jar"]
  </code></pre>
  
  <p>is there any way to execute a command like "mvn clean install -P docker" in each directory before running docker-compose to ensure that the jar that will be included in the image has been compiled with the right profile? 
  The command must be excited BEFORE cretae the container (out of the container to complile the jar that will be included within the container NOT inside the container)</p>
  
  <p>Thanks</p>