Automated Build and Out Of Memory

I have a Dockerfile which compiles a quite huge program. Linking this requires a little memory. This results in an Out Of Memory.

Error Message:

dmd -L-ldl -m64 -O -J./ -ofhiggs util/error.d util/id.d util/string.d util/misc.d util/bitset.d parser/lexer.d parser/ast.d parser/vars.d parser/parser.d ir/ir.d ir/ops.d ir/iir.d ir/ast.d ir/peephole.d ir/slotalloc.d ir/livevars.d ir/inlining.d ir/analysis.d runtime/vm.d runtime/layout.d runtime/string.d runtime/object.d runtime/gc.d jit/x86.d jit/codeblock.d jit/util.d jit/moves.d jit/ops.d jit/jit.d repl.d options.d stats.d main.d jit/tests.d parser/tests.d runtime/tests.d ffi/os.d ffi/tests.d 

e[91munable to fork: Cannot allocate memory
e[0m
makefile:71: recipe for target 'all' failed

Docker-Hub Project: https://hub.docker.com/r/dlanguage/higgs/

Does anyone know how to work around this? Currently I need to build the images locally and push. Would be great if docker hub could build them; even when it would be slower than normal builds, cause they use a little more memory.