Note that you will need to load the correct ssl certificates into the folder ssl/
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG DEPENDENCY=target/
COPY ${DEPENDENCY}/lib /app/dependency
COPY ${DEPENDENCY}/classes /app
COPY ssl/ /etc/letsencrypt/live/
ENTRYPOINT ["java","-cp","app:app/dependency/*","-Dspring.profiles.active=${profiles}","-Dspring.datasource.url=${jdbcUrl}","-Dspring.datasource.username=${jdbcUsername}","-Dspring.datasource.password=${jdbcPassword}", "gara.core.StrategyStarter"]
Please modify the environment variables inside strategy if that is need it in order to use other different db or change the profiles.
version: "3.5"
services:
mysql:
image: mysql:5.7
container_name: mysql
volumes:
- ./data/db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: garaquant
MYSQL_USER: user
MYSQL_PASSWORD: password
ports:
- 3306:3306
networks:
- backend
strategy:
build: .
container_name: strategy
environment:
- jdbcUrl=jdbc:mysql://mysql:3306/garaquant?useSSL=false
- jdbcUsername=user
- jdbcPassword=password
- profiles=production,liquibase
ports:
- 8080:8080
depends_on:
- mysql
networks:
- backend
networks:
backend:
internal: false
After set app the parameters above please:
docker-compose up -d
Optional would be possible to build the docker image manually, and in our case push it to docker-hub:
docker build -t garaquant/strategy .
docker tag garaquant/strategy:latest garaquant/strategy:{version}
docker push garaquant/strategy:{version}