| # service configuration for our dockerized Java app |
| version: '3.7' |
| |
| services: |
| app: |
| # use the Dockerfile next to this file |
| build: |
| context: ../ |
| dockerfile: ./docker-resources/app/Dockerfile |
| # uncomment, if no remote debugging app is required |
| environment: |
| - MAVEN_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000 |
| |
| # this runs the app server in the container, be sure not to filter resources once again! |
| command: mvn -Pjetty,docker |
| ports: |
| - "8081:8081" |
| # remote debugging port, uncomment if not needed |
| - "9000:9000" |
| |
| # makes the app container aware of the DB container |
| depends_on: |
| - db |
| # |
| #expose: |
| # - "3000" |
| |
| volumes: |
| # project root wtih pom.xml and src folder |
| - ../../:/myapp |
| # or use local sapp/ettings.xml |
| - '#var("app_volume_local_repo"):/m2repo' |
| |
| db: |
| # set the build context |
| build: |
| context: ../ |
| dockerfile: ./docker-resources/db/Dockerfile |
| args: |
| DB_CONTEXT: ./docker-resources/db |
| MYSQL_DATABASE: ${turbine_database_name} |
| MYSQL_ROOT_PASSWORD: changeit |
| MYSQL_USER: ${turbine_database_user} |
| MYSQL_PASSWORD: ${turbine_database_password} |
| |
| environment: |
| MYSQL_DATABASE: ${turbine_database_name} |
| MYSQL_ROOT_PASSWORD: changeit |
| MYSQL_USER: ${turbine_database_user} |
| MYSQL_PASSWORD: ${turbine_database_password} |
| DB_CONTEXT: ./docker-resources/db |
| |
| volumes: |
| - "./db/mysql/init:/docker-entrypoint-initdb.d" |
| - "./db/mysql/conf:/etc/mysql/conf.d" |
| - "./db/mysql/data:/data" |
| - "./db/mysql/log:/mysql/log" |
| # default mysql persistent data |
| - db_data_${turbine_database_name}:/var/lib/mysql:rw |
| restart: always |
| ports: |
| # host: container |
| - "13306:3306" |
| |
| #networks: |
| # - db |
| #command: [mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci] |
| command: --default-authentication-plugin=mysql_native_password |
| |
| # this might work only for *nix, check with docker image inspect db |
| volumes: |
| db_data_${turbine_database_name}: |
| |
| #networks: |
| # db: |