application-mysql.properties:
spring.datasource.url=jdbc:mysql://ec-mysql:3306/explorecali spring.datasource.username=cali_user spring.datasource.password=cali_pass
Dockerfile: run with profile
FROM java:8 WORKDIR / ADD target/explorecali-2.0.0-SNAPSHOT.jar // EXPOSE 8080 ENTRYPOINT [ "java", "-jar", "-Dspring.profiles.active=mysql", "/explorecali-3.0.0-SNAPSHOT.jar"]
Build the applciation:
mvn package -DskipTests=true
Build the image:
docker build -t explorecali .
Link mysql image to application image:
docker run --name ec-app -p 8080:8080 --link ec-mysql:mysql -d explorecali