Files
gridpilot.gg/docker-compose.test.yml
2026-01-03 11:38:51 +01:00

91 lines
2.5 KiB
YAML

services:
# Ready check - simple service that verifies dependencies are available
ready:
image: node:20-alpine
working_dir: /app
volumes:
- ./:/app
command:
[
"sh",
"-lc",
"set -e; echo '[ready] Checking dependencies...'; if [ -d \"/app/node_modules\" ] && [ -f \"/app/node_modules/.package-lock.json\" ]; then echo '[ready] Dependencies found'; exit 0; else echo '[ready] Dependencies not found - please run: npm install'; exit 1; fi"
]
networks:
- gridpilot-test-network
restart: "no"
# Real API server (not mock)
api:
image: node:20-alpine
working_dir: /app/apps/api
environment:
- NODE_ENV=test
- PORT=3000
- GRIDPILOT_API_PERSISTENCE=inmemory
- GRIDPILOT_API_BOOTSTRAP=true
- GRIDPILOT_API_FORCE_RESEED=true
- GRIDPILOT_FEATURES_JSON={"sponsors.portal":"enabled","admin.dashboard":"enabled"}
ports:
- "3101:3000"
volumes:
- ./:/app
- /Users/marcmintel/Projects/gridpilot/node_modules:/app/node_modules:ro
command: ["sh", "-lc", "echo '[api] Starting real API...'; npm run start:dev"]
depends_on:
ready:
condition: service_completed_successfully
networks:
- gridpilot-test-network
restart: unless-stopped
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://localhost:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 2s
timeout: 2s
retries: 30
start_period: 10s
# Website server for integration tests
website:
image: node:20-alpine
working_dir: /app/apps/website
environment:
- NODE_ENV=test
- NEXT_TELEMETRY_DISABLED=1
- API_BASE_URL=http://api:3000
ports:
- "3100:3000"
volumes:
- ./:/app
- /Users/marcmintel/Projects/gridpilot/node_modules:/app/node_modules:ro
command: ["sh", "-lc", "echo '[website] Waiting for API...'; npm run dev --workspace=@gridpilot/website"]
depends_on:
ready:
condition: service_completed_successfully
api:
condition: service_healthy
networks:
- gridpilot-test-network
restart: unless-stopped
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://localhost:3000').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 5s
timeout: 10s
retries: 15
start_period: 30s
networks:
gridpilot-test-network:
driver: bridge