Spawning a full Node process for health checks is slow on Alpine and can exceed the 3s timeout, causing the container to be marked unhealthy. Use wget (built into Alpine) instead, and increase start_period to 15s.
39 lines
739 B
YAML
39 lines
739 B
YAML
services:
|
|
server:
|
|
build: ./server
|
|
networks:
|
|
- inventory-network
|
|
volumes:
|
|
- server-data:/data
|
|
environment:
|
|
- API_KEY=${API_KEY:-}
|
|
- TURTLE_SERVER_URL=${TURTLE_SERVER_URL:-}
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:3001/api/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
start_period: 15s
|
|
retries: 3
|
|
|
|
client:
|
|
build:
|
|
context: ./client
|
|
args:
|
|
VITE_API_KEY: ${API_KEY:-}
|
|
ports:
|
|
- "80:80"
|
|
networks:
|
|
- inventory-network
|
|
depends_on:
|
|
server:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
inventory-network:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
server-data:
|