application-docker.properties:
spring.datasource.url=jdbc:mysql://${server}:${port}/explorecali spring.datasource.username=${dbuser} spring.datasource.password=${dbpassword} spring.flyway.check-location=false spring.flyway.locations=filesystem:/var/migration
Dockerfile:
FROM java:8 WORKDIR / ADD target/explorecali-2.0.0-SNAPSHOT.jar // EXPOSE 8080 ENTRYPOINT [ "java", "-jar", "-Dspring.profiles.active=docker", "/explorecali-3.0.0-SNAPSHOT.jar"]
Build jar for application:
mvn package -DskipTests=true
Create image:
docker build -t explorecali .
Setup volumn for db migration scirpt such as flyaway:
docker run --name ec-app -p 8080:8080 -v ~/db/migration:/var/migration -e server=ec-mysql -e port=3306 -e dbuser=cali_user -e dbpassword=cali_pass --link ec-mysql:mysql -d explorecali