mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-14 19:56:34 +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-retries 5 ; \
|
||||||
npm config set fetch-retry-mintimeout 15000 ; \
|
npm config set fetch-retry-mintimeout 15000 ; \
|
||||||
npm install --no-audit; \
|
npm install --no-audit; \
|
||||||
# React client build
|
# Build React client
|
||||||
NODE_OPTIONS="--max-old-space-size=2048" npm run frontend; \
|
NODE_OPTIONS="--max-old-space-size=2048" npm run frontend; \
|
||||||
npm prune --production; \
|
npm prune --production; \
|
||||||
npm cache clean --force
|
npm cache clean --force
|
||||||
|
|
@ -31,6 +31,12 @@ RUN mkdir -p /app/client/public/images /app/api/logs
|
||||||
# Node API setup
|
# Node API setup
|
||||||
EXPOSE 3080
|
EXPOSE 3080
|
||||||
ENV HOST=0.0.0.0
|
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"]
|
CMD ["npm", "run", "backend"]
|
||||||
|
|
||||||
# Optional: for client with nginx routing
|
# Optional: for client with nginx routing
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,6 @@ services:
|
||||||
- ./images:/app/client/public/images
|
- ./images:/app/client/public/images
|
||||||
- ./uploads:/app/uploads
|
- ./uploads:/app/uploads
|
||||||
- ./logs:/app/api/logs
|
- ./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:
|
mongodb:
|
||||||
container_name: chat-mongodb
|
container_name: chat-mongodb
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue