During the course of a deployment, there are a number of maintenance scripts that scap may run, such as purgeMessageBlobStore.php and rebuildLocalisationCache.php.
There is also the scap mwscript command for running arbitrary maintenance scripts in the context of the MediaWiki staging directory (i.e., /srv/mediawiki-staging).
My understanding is that following recent work by @dduvall, all of this happens in a Docker container with a bind-mount for the staging directory, using the mediawiki_runtime_image which currently defaults to docker-registry.wikimedia.org/php7.4-fpm-multiversion-base.
Given where we are with the production migration of PHP 8.1 (T383845), it probably makes sense to switch this to the 8.1 equivalent.