Skip to content

Commit

Permalink
add compose healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
mucsi96 committed Sep 15, 2024
1 parent a11160a commit 40c4d72
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ VOLUME /tmp

ARG DEPENDENCY=/workspace/server/target/dependency

RUN apk add postgresql16-client
RUN apk add postgresql16-client curl

COPY --from=build-server ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build-server ${DEPENDENCY}/META-INF /app/META-INF
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,26 @@ services:
- "8080:8080"
volumes:
- "./test/databases_config.json:/app/databases_config.json"
healthcheck:
test: "curl --fail --silent localhost:8082/actuator/health/readiness | grep UP || exit 1"
interval: 2s
timeout: 3s
retries: 5
start_period: 2s
depends_on:
- db1
- db2
- blobstorage

blobstorage:
image: "mcr.microsoft.com/azure-storage/azurite"
command: "azurite-blob --blobHost 0.0.0.0"
ports:
- "8081:10000"
healthcheck:
test: nc 127.0.0.1 10000 -z
interval: 1s
retries: 30

db1:
image: "postgres:16.2-bullseye"
Expand All @@ -30,6 +44,11 @@ services:
POSTGRES_USER: "postgres"
ports:
- "8082:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

db2:
image: "postgres:16.2-bullseye"
Expand All @@ -39,3 +58,8 @@ services:
POSTGRES_USER: "postgres"
ports:
- "8083:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5

0 comments on commit 40c4d72

Please sign in to comment.