version: '3.8' services: redis: image: redis:7-alpine container_name: star-wars-redis ports: - "6379:6379" volumes: - redis-data:/data command: redis-server --appendonly yes restart: unless-stopped networks: - star-wars-network healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 3s retries: 3 star-wars-game: build: context: . dockerfile: Dockerfile container_name: star-wars-hearthstone ports: - "3542:3542" environment: - NODE_ENV=production - PORT=3542 - USE_REDIS=${USE_REDIS:-true} - REDIS_URL=${REDIS_URL:-redis://redis:6379} - SESSION_SECRET=${SESSION_SECRET:-star-wars-hearthstone-secret-key-change-in-production} - COOKIE_SECURE=${COOKIE_SECURE:-false} restart: unless-stopped depends_on: redis: condition: service_healthy networks: - star-wars-network healthcheck: test: ["CMD", "node", "-e", "require('http').get('http://localhost:3542', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"] interval: 30s timeout: 3s retries: 3 start_period: 5s volumes: redis-data: networks: star-wars-network: driver: bridge