java - How to quickly integrate the maven project into the docker -




i have maven project project structure follows:

parentproject:

  1. parentproject:

    aporject.war

    bproject.war

  2. parentapiproject:

    aprojectapi.jar

    bprojectapi.jar

i package project @ same time following 4 items copied 4 docker, , run up。

is there ideas , technical solutions?

i prefer build images after jar/war files ready (another option integrate maven plugin). in both options need create dockerfile first.

you have 4 applications need 4 containers (one container - 1 thing or 1 service run). every container have own base image , setup depending on how run application.

for example, dockerfile copy jar file image , run using openjdk:

from openjdk:8-jdk volume /tmp  copy ./target/application.jar /application.jar run bash -c 'touch /application.jar'  entrypoint exec java $java_opts -jar /application.jar expose 7000 

to run war files need tomcat image.

after added dockerfiles custom applications next step create docker-compose.yml file. include containers need run whole project (4 custom applications, databases or other services).

version: '3' services:   application:     build: ./path_to_dockerfile     ports:       - 7000:7000     environment:       - database_password=askwejufy1apl3dznv       - ... other credentials or application configs should passed environment variables       - java_opts=-xmx512m -xms256m -djava.security.egd=file:/dev/./urandom -xdebug -xrunjdwp:server=y,transport=dt_socket,suspend=n     restart:     depends_on:       - application-db   application-db:     build: ./path_to_db_dockerfile # can set image name without dockerfile db     ports:       - 5432:5432     restart:     volumes:       - db-data     environment:      - database_password=askwejufy1apl3dznv    #    # configuration other containers   #  volumes:   db-data: 

there setup paths dockerfiles, create private network dependencies , after ready can run docker-compose up command.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -