Precompile assets docker

Used Zammad version: 5.3.0
Used Zammad installation type: docker-compose
Operating system: Ubuntu 20.04

I need to know the steps to compile the assets via docker .
In package edition is used
zammad run rake assets:precompile

Hey,

i’m just gonna steal the answer:

cheers

Hi
Maybe i use in wrong way?

---------------------------- One ----------------

rake assets:precompile

Command ‘rake’ not found, but can be installed with:

snap install ruby # version 3.1.3, or
apt install rake # version 13.0.1-4

See ‘snap info ruby’ for additional versions.

------------------------------Two ------------------
sudo docker exec -it e3ba2ff61022 sh
$ rake assets:precompile
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See GitHub - rails/execjs: Run JavaScript code from Ruby for a list of available runtimes.
/usr/local/bundle/gems/execjs-2.8.1/lib/execjs/runtimes.rb:58:in autodetect' /usr/local/bundle/gems/execjs-2.8.1/lib/execjs.rb:5:in module:ExecJS
/usr/local/bundle/gems/execjs-2.8.1/lib/execjs.rb:4:in <main>' /usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require’
/usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require' /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in require’
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in block in require' /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in load_dependency’
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in require' /opt/zammad/config/application.rb:32:in block in <top (required)>’
/opt/zammad/config/application.rb:31:in select' /opt/zammad/config/application.rb:31:in <top (required)>’
/opt/zammad/Rakefile:7:in require_relative' /opt/zammad/Rakefile:7:in <top (required)>’
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>’
(See full trace by running task with --trace)

I never used the docker installation but maybe you’re still missing Node.js which is essential to precompile on source installations since 5.0. Can you make sure it’s installed and you’re using the correct version?

Node.js dependency

Please note that starting with Zammad 5.0 you’ll need Node.js to run ‘rake assets:precompile’.
This affects all source code installations and those who change javascript or stylesheet files in Zammad.

Find out more in our documentation.

Source: Major Release: Zammad 5.0

Hi
Any idea?

node -v
v16.19.0
root@mylinux:~# sudo docker exec -it e3ba2ff61022 sh
$ rake assets:precompile
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See GitHub - rails/execjs: Run JavaScript code from Ruby for a list of available runtimes.
/usr/local/bundle/gems/execjs-2.8.1/lib/execjs/runtimes.rb:58:in autodetect' /usr/local/bundle/gems/execjs-2.8.1/lib/execjs.rb:5:in module:ExecJS
/usr/local/bundle/gems/execjs-2.8.1/lib/execjs.rb:4:in <main>' /usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require’
/usr/local/bundle/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in require' /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in require’
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in block in require' /usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:299:in load_dependency’
/usr/local/bundle/gems/activesupport-6.1.7/lib/active_support/dependencies.rb:332:in require' /opt/zammad/config/application.rb:32:in block in <top (required)>’
/opt/zammad/config/application.rb:31:in select' /opt/zammad/config/application.rb:31:in <top (required)>’
/opt/zammad/Rakefile:7:in require_relative' /opt/zammad/Rakefile:7:in <top (required)>’
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>’
(See full trace by running task with --trace)

Which container are you using?
Your UID you’re using doesn’t help us to understand what you’re doing.

You can hardly expect any help with the level of information you’re sharting.

@MrGeneration
zammad-docker-compose-zammad-railsserver-1

docker ps

77eeb66166a6 zammad/zammad-docker-compose:5.3.1-6
d681d45ace11 zammad/zammad-docker-compose:5.3.1-6
08a565b5d862 postgres:15.1-alpine
abfe207869c0 zammad/zammad-docker-compose:5.3.1-6
e3ba2ff61022 zammad/zammad-docker-compose:5.3.1-6
18b90502a464 bitnami/elasticsearch:8.5.1
2019d24b6795 postgres:15.1-alpine
5df1b1b87087 redis:7.0.5-alpine
464bf8f3a541 memcached:1.6.17-alpine

Maybe must add nodejs to DEPLOY_PACKAGES within the Dockerfile to fix the missing ExecJS runtime ?

If yes, How?

Looks like the container doesn’t come with the requirements. It also looks like this is actually wanted maintainer sided.

See:

The suggestion is to actually create your own container.
I personally always suggest to not use docker containers when you want to actually adjsut things in Zammad. Here’s just one more reason why not to. But I can’t stop you guys anyway. :slight_smile:

So don’t use docker, build on scratch or somehow install nodejs in the container are your options.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.