x-defaults: &defaults
  restart: unless-stopped
  logging:
    driver: json-file
    options:
      max-size: 100m
      max-file: '3'

services:
  bolt-diy:
    <<: *defaults
    image: ${GLOBAL_REGISTRY:-}stackblitz/bolt:${BOLT_DIY_VERSION:-latest}
    ports:
      - '${BOLT_DIY_PORT_OVERRIDE:-5173}:5173'
    environment:
      - TZ=${TZ:-UTC}
      - VITE_LOG_LEVEL=${VITE_LOG_LEVEL:-info}
      - ENABLE_EXPERIMENTAL_FEATURES=${ENABLE_EXPERIMENTAL_FEATURES:-false}
    deploy:
      resources:
        limits:
          cpus: ${BOLT_DIY_CPU_LIMIT:-2.00}
          memory: ${BOLT_DIY_MEMORY_LIMIT:-2G}
        reservations:
          cpus: ${BOLT_DIY_CPU_RESERVATION:-0.5}
          memory: ${BOLT_DIY_MEMORY_RESERVATION:-512M}
    healthcheck:
      test:
        - CMD
        - wget
        - --no-verbose
        - --tries=1
        - --spider
        - 'http://localhost:5173/'

      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
