Skip to content

Commit

Permalink
complete auto restart of container
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Oct 15, 2024
1 parent c9b9162 commit 9084139
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions docker/local-prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,32 @@ services:
volumes:
- ../../../okr/backend/target:/app-root/backend
network_mode: "host"
depends_on:
maven-init:
condition: service_completed_successfully

maven:
tty: true
container_name: maven
restart: on-failure
image: maven:3.9.9-amazoncorretto-21
command: sh -c "mvn -B clean package -P build-for-docker,debug && mvn fizzed-watcher:run"
command: mvn fizzed-watcher:run
working_dir: /app-root/
volumes:
- ../../../okr:/app-root/
- ../../../okr:/app-root
- ~/.m2/repository:/root/.m2/repository
depends_on:
maven-init:
condition: service_completed_successfully

maven-init:
tty: true
container_name: maven-init
image: maven:3.9.9-amazoncorretto-21
command: mvn -B clean package -P build-for-docker,debug
working_dir: /app-root/
volumes:
- ../../../okr:/app-root
- ~/.m2/repository:/root/.m2/repository

angular:
Expand Down
2 changes: 1 addition & 1 deletion docker/local-prod/local-prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ USER 1001

WORKDIR app-root/backend

ENTRYPOINT ["/bin/sh", "-c", "pwd; export BACKEND_VERSION=$(find . -type f -name 'backend-*.jar' -print -quit | sed -n 's/.*backend-\\(.*\\)\\.jar/\\1/p'); while true; do [ -f \"backend-${BACKEND_VERSION}.jar\" ] && (java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005 -jar backend-${BACKEND_VERSION}.jar & pid=$!; inotifywait -e modify backend-${BACKEND_VERSION}.jar; kill -9 $pid; echo 'JAR updated. Restarting...') || echo \"File backend-${BACKEND_VERSION}.jar does not exist.\"; done"]
ENTRYPOINT ["/bin/sh", "-c", "export BACKEND_VERSION=$(find . -type f -name 'backend-*.jar' -print -quit | sed -n 's/.*backend-\\(.*\\)\\.jar/\\1/p'); while true; do java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=*:5005 -jar backend-${BACKEND_VERSION}.jar & pid=$!; inotifywait -e modify backend-${BACKEND_VERSION}.jar; exit 1; done"]

0 comments on commit 9084139

Please sign in to comment.