From 4fabb38dd9109e4641bc6ca71a1da38516e0d504 Mon Sep 17 00:00:00 2001 From: Lewis Crichton Date: Wed, 24 May 2023 10:14:04 +0100 Subject: [PATCH] healthchecks --- Dockerfile | 4 +++- docker-compose.yml | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 10f623d..f421b9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,9 @@ RUN go build -o backend FROM alpine:latest -RUN apk --no-cache add ca-certificates +RUN apk --no-cache add ca-certificates curl COPY --from=builder /app/backend /backend + +HEALTHCHECK --interval=15s --timeout=3s CMD curl -f http://localhost:8080/v1/ || exit 1 CMD ["/backend"] diff --git a/docker-compose.yml b/docker-compose.yml index 536bd8e..7783c94 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,13 @@ services: restart: always volumes: - ./redis-data:/data + environment: + REDIS_ARGS: --save 300 1 60 10 + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 5s + timeout: 5s + retries: 5 backend: image: vencord/backend @@ -15,4 +22,5 @@ services: env_file: - .env depends_on: - - redis + redis: + condition: service_healthy