mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-26 13:18:51 +01:00
🚀 feat: Implement health check for backend service in Dockerfile
This commit is contained in:
parent
be060cbfb7
commit
cc8e4dbb77
2 changed files with 7 additions and 7 deletions
|
|
@ -21,7 +21,7 @@ RUN \
|
|||
npm config set fetch-retries 5 ; \
|
||||
npm config set fetch-retry-mintimeout 15000 ; \
|
||||
npm install --no-audit; \
|
||||
# React client build
|
||||
# Build React client
|
||||
NODE_OPTIONS="--max-old-space-size=2048" npm run frontend; \
|
||||
npm prune --production; \
|
||||
npm cache clean --force
|
||||
|
|
@ -31,6 +31,12 @@ RUN mkdir -p /app/client/public/images /app/api/logs
|
|||
# Node API setup
|
||||
EXPOSE 3080
|
||||
ENV HOST=0.0.0.0
|
||||
|
||||
# Define a health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=5 \
|
||||
CMD curl -f http://localhost:3080/health || exit 1
|
||||
|
||||
# Start the backend service
|
||||
CMD ["npm", "run", "backend"]
|
||||
|
||||
# Optional: for client with nginx routing
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@ services:
|
|||
- ./images:/app/client/public/images
|
||||
- ./uploads:/app/uploads
|
||||
- ./logs:/app/api/logs
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://api:${PORT}/health || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
mongodb:
|
||||
container_name: chat-mongodb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue