EMBER_CLI_PROD_ASSETS를 1로 설정하면 자산 사전 컴파일 시 충돌

기록을 위해, 그리고 혹시 주변 누군가에게 도움이 될 수 있을지 모르겠지만. 무작위 uid를 사용하면서 ember cli가 예상대로 작동하도록 만드는 방법이 최소한 하나 있습니다. 그것은 rake assets:precompile 작업을 실행할 시점에 할당된 무작위 uid가 /etc/passwd에 항목으로 존재하도록 보장하는 것입니다.

다음과 같은 것 말이죠:

if [ `id -u` -ge 10000 ]; then
  cat /etc/passwd | sed -e "s/^discourse:/builder:/" > /tmp/passwd
  echo "discourse:x:`id -u`:`id -g`:,,,:/home/discourse:/bin/bash" >> /tmp/passwd
  cat /tmp/passwd > /etc/passwd
  rm /tmp/passwd
fi

이렇게 하면 app/assets/javascripts/discourse run ember build -prod 명령어(discourse/assets.rake at tests-passed · discourse/discourse · GitHub에서 가져온)가 성공적으로 실행됩니다.

yarn run v1.22.17
$ /discourse/app/assets/javascripts/node_modules/.bin/ember build -prod
WARNING: Node v16.13.2 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n  for details.
DEPRECATION: The integration of jQuery into Ember has been deprecated and will be removed with Ember 4.0. You can either opt-out of using jQuery, or install the `@ember/jquery` addon to provide the jQuery integration. Please consult the deprecation guide for further details: https://emberjs.com/deprecations/v3.x#toc_jquery-apis 
- Building
Environment: production
- Building
- building... 
[WARN] (broccoli-terser-sourcemap) Minifying "assets/chunk.529.6ee9018498e97f872147.js" took: 24288ms (more than 20,000ms)
...

또한 이 작업이 꽤 비용이 많이 든다는 것도 알게 되었습니다. 사전 컴파일에만 거의 2GB의 램을 소비하니까요 :scream:

감사합니다,
Ismael