bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.4k stars 4.86k forks source link

[bitnami/discourse] Pre-Compile Discourse JS files #71160

Closed davispuh closed 1 month ago

davispuh commented 2 months ago

Name and Version

bitnami/discourse:3

What is the problem this feature will solve?

Currently when Ember/Babel/Webpack is optimizing JS files then that requires a lot of RAM and CPU time. Also while it's doing that VM is completely unresponsive. I'm not able to use this image in a VM since it's getting OOM killed.

! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
yarn run v1.22.22
$ /opt/bitnami/discourse/node_modules/.bin/ember build -prod
Building
Environment: production
building...
...[ConfigLoader]
...[Babel: @ember/render-modifiers > applyPatches]
...[Babel: ember-source > applyPatches]
...[ember.js]
...[Babel: @glimmer/component > applyPatches]
...[Babel: pretty-text > applyPatches]
...[Babel: discourse-common > applyPatches]
...[Babel: @ember/legacy-built-in-components > applyPatches]
...[Babel: @ember/test-helpers > applyPatches]
...[Babel: @ember/test-waiters > applyPatches]
...[Babel: ember-buffered-proxy > applyPatches]
...[Babel: ember-load-initializers > applyPatches]
...[Babel: float-kit > applyPatches]
...[Babel: select-kit > applyPatches]
...[@embroider/compat/app]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
Killed
[ 2387.114944] Out of memory: Killed process 18111 (ember) total-vm:47240900kB, anon-rss:961964kB, file-rss:0kB, shmem-rss:0kB, UID:101 pgtables:43208kB oom_score_adj:200

What is the feature you are proposing to solve the problem?

Include already optimized JS files in image itself so users don't need to invoke this step.

What alternatives have you considered?

No response

juan131 commented 2 months ago

Hi @davispuh

We actually run RAILS_ENV=production bundle exec rake assets:precompile while building the Discourse package that we later on use to build the container image. Please note that, under the hood, this runs the /opt/bitnami/discourse/node_modules/.bin/ember build -prod command.

Is there a reason why you had to run the command again? Is it a consequence of adding custom plugins or similar?

davispuh commented 2 months ago

I don't have any reason to run it, it just does it automatically, but I found that I can pass DISCOURSE_PRECOMPILE_ASSETS=no env var and then it's skipped.

github-actions[bot] commented 1 month ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 1 month ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.