From 16f04235da90ed7edea2a9372ee35eb2a3404ba3 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Mon, 22 May 2023 17:30:59 +0800 Subject: [PATCH] chore: add health check in docker file --- Dockerfile | 3 +++ docker/simple/docker-compose.yml | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95a9af8f..5cb72657 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,5 +40,8 @@ RUN pnpm build # web static service port EXPOSE 3000 +# health check +HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD wget localhost:3000/health -q -O - > /dev/null 2>&1 + # Start server, ENV var is necessary CMD ["pnpm", "start:service"] diff --git a/docker/simple/docker-compose.yml b/docker/simple/docker-compose.yml index f0ef00d0..f79df06d 100644 --- a/docker/simple/docker-compose.yml +++ b/docker/simple/docker-compose.yml @@ -17,12 +17,6 @@ services: - "traefik.enable=true" - "traefik.http.routers.api-gw.rule=PathPrefix(`/`)" - "traefik.http.services.api-gw.loadbalancer.server.port=3000" - healthcheck: - test: [ "CMD", "curl", "-f", "http://localhost:3000/health" ] - interval: 30s - timeout: 5s - retries: 5 - start_period: 30s networks: - internal