Speed up webpack for asset compilation

Description

gitlab:asset:compile uses webpack to build the assets. Due to amount of assets we have and way webpack is used, this process can take a very long time.

For example, in our release builds, we often see timings such as:

[Builder: gitlab-rails] I | 2017-07-18T23:10:31+00:00 | bundle `exec rake gitlab:assets:compile': 763.4142s

This is 13 minutes spent only on compiling assets.

While debugging an unrelated issue, I've noticed that webpack only uses one CPU core. This is a waste because our build machines are very powerful.

Proposal

We should look into whether we can parallelize this task. For example, quick search produced: https://github.com/trivago/parallel-webpack as one example.

There are probably way better tools or better ways to do this, but webpack doesn't seem to be capable of multithreading.

/cc @lbennett @mikegreiling

Edited by Marin Jankovski