Compare commits

...

3 Commits

2 changed files with 15 additions and 2 deletions

View File

@@ -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=10s --timeout=5s --start-period=30s --retries=3 \
CMD curl -f http://localhost:3080/health
# Start the backend service
CMD ["npm", "run", "backend"] CMD ["npm", "run", "backend"]
# Optional: for client with nginx routing # Optional: for client with nginx routing

View File

@@ -1,5 +1,5 @@
# Do not edit this file directly. Use a docker-compose.override.yaml file if you can. # Do not edit this file directly. Use a docker-compose.override.yaml file if you can.
# Refer to `docker-compose.override.yaml.example for some sample configurations. # Refer to `docker-compose.override.yaml.example` for some sample configurations.
services: services:
api: api:
@@ -27,6 +27,13 @@ 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" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
mongodb: mongodb:
container_name: chat-mongodb container_name: chat-mongodb
image: mongo image: mongo