In the docker template file, some commands must be followed by -j$(nproc). What does it mean?
For example: when php installs gd library: docker-php-ext-install -j$(nproc) gd
There's no "must" about -j
, it's optional to spawn nproc
[which is a command to return the number of processors] parallel build jobs to compile the extensions. It is simply passed through to make
's -j
option:
-j [jobs], --jobs[=jobs] Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.
Really docker-php-ext-install is just a bit of bash handwaving around make: https://github.com/docker-library/php/blob/master/docker-php-ext-install
TLDR: -j$(nproc)
make build go fast.