services:
  playwright-init:
    image: mcr.microsoft.com/playwright:v1.55.0-noble
    user: "root"
    volumes:
      - ./data:/home/pwuser/app
      - ./config:/home/pwuser/config:ro
    working_dir: /home/pwuser/app
    command: >
      sh -c "
        cp -r /home/pwuser/config/* /home/pwuser/app/ &&
        chown -R pwuser:pwuser /home/pwuser/app &&
        chmod +x /home/pwuser/app/start.sh
      "
    restart: "no"
    
  playwright:
    image: mcr.microsoft.com/playwright:v1.55.0-noble
    container_name: ${CONTAINER_NAME}
    restart: always
    networks:
      - 1panel-network
    ports:
      - "${PANEL_APP_PORT_HTTP}:3000"
    volumes:
      - ./data:/home/pwuser/app
    working_dir: /home/pwuser/app
    user: "pwuser"
    environment:
      - NODE_ENV=production
      - PORT=3000
    init: true
    ipc: host
    security_opt:
      - seccomp:unconfined
    command: "./start.sh"
    depends_on:
      playwright-init:
        condition: service_completed_successfully
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 90s
    labels:
      createdBy: "Apps"

networks:
  1panel-network:
    external: true