services:
  scan:
    build:
      context: .
      dockerfile: Dockerfile
    platform: linux/amd64
    volumes:
      - ${TARGET_REPO:-.}:/target:ro
    environment:
      EXCLUDE_PACKAGES: ${EXCLUDE_PACKAGES:-pip,setuptools,wheel}
      PRIVATE_NPM_SCOPES: ${PRIVATE_NPM_SCOPES:-theorchard}
      SCAN_WORKERS: ${SCAN_WORKERS:-8}
      NPM_SCAN_WORKERS: ${NPM_SCAN_WORKERS:-4}
    # ENTRYPOINT is already `python -u /app/guarddog_scanner.py`; command provides args only
    command: ["/target", "--scan-type", "${SCAN_TYPE:-all}"]

  test:
    build:
      context: .
      dockerfile: Dockerfile.tests
    platform: linux/amd64
    volumes:
      - ./build:/app/build
    # Default: plain terminal output.
    # CI overrides command to: --junitxml=build/pyunit.xml --cov=... etc.
    command: []
