I am building a large Bazel project in a cloud VM with /tmp in a small filesystem (~8 GB). Occasionally my build fails with the error Not all outputs were created: the filesystem containing /tmp is at 99% of capacity, and /tmp contains many Bazel build artifacts.
How can I override the temporary directory that Bazel uses? I tried setting the TEMP and TMPDIR environment variables when starting bazel build, but this did not help.