# Optional CPU/memory overlay for the docker-worker (TF-1002). Layered onto
# docker-compose.yml via a second `-f` ONLY when the worker spec carries a
# resource limit (dockerWorkerController().ensure() in
# src/server/provider-controllers.ts decides whether to add this file to the
# compose invocation).
#
# This lives in its own file rather than inline in docker-compose.yml because
# compose has no way to omit a `deploy.resources.limits` key entirely when its
# value is unset — an empty string fails to parse
# (strconv.ParseFloat/invalid size), and a "0" default still leaves a resolved
# `limits: {}` behind (`docker compose config` proof: unset renders `deploy:
# resources: limits: {}`, not an absent `deploy` key at all — not
# byte-identical to the pre-TF-1002 baseline, which has no `deploy` key).
# Applying limits only as an additive overlay is what keeps the DEFAULT config
# (no `-f docker-compose.resources.yml`) byte-identical to before this change.
#
# TERMFLEET_WORKER_CPUS / TERMFLEET_WORKER_MEMORY have no `:-default` here —
# this file is only ever passed to `docker compose` when both are already
# known to be set (see dockerWorkerController().ensure()), so an unset var
# reaching this file would be a caller bug, not a case to silently default.
services:
  termfleet:
    deploy:
      resources:
        limits:
          cpus: "${TERMFLEET_WORKER_CPUS}"
          memory: "${TERMFLEET_WORKER_MEMORY}"
