ci(docker): increase health check start period and use localhost IP

- Increase start_period from 5s to 10s to allow more time for service initialization
- Change health check URL from localhost to 127.0.0.1 for better compatibility
This commit is contained in:
Jp
2026-02-02 01:01:12 +08:00
parent 39c16f5090
commit cb4a7eadac
3 changed files with 4 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ RUN npm run build
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/health || exit 1
CMD ["npm", "start"]

Binary file not shown.

View File

@@ -10,8 +10,8 @@ services:
- PORT=3000
- NODE_ENV=production
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:3000/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
start_period: 10s