Docker image out of Memory

I am trying to create the toolchain using the docker image, following the instructions here.

The Docker image starts building correctly, it progresses, but when it gets to line 35 in the docker file it fails and I always end up getting this error (which clearly indicates the process is out of memory):

Dockerfile:35
--------------------
  33 |     
  34 |     # Build toolchains
  35 | >>> RUN JOBS=$JOBS make toolchain-mac
  36 |     RUN JOBS=$JOBS make toolchain-win
  37 |     RUN JOBS=$JOBS make toolchain-lin
--------------------
ERROR: failed to solve: ResourceExhausted: process "/bin/sh -c JOBS=$JOBS make toolchain-mac" did not complete successfully: cannot allocate memory

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/btkp3zl51p24ie6rqkqhfpea3

I am working on a Mac M2 with 8GB of RAM (and I have closed any other application). Is there anything I can do to lower the memory consumption and complete the build? Or to allocated more Memory to the docker build? Any help appreciated!