Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't deploy with Kamal after install esbuild #208

Open
sbleon opened this issue Jan 21, 2025 · 0 comments
Open

Can't deploy with Kamal after install esbuild #208

sbleon opened this issue Jan 21, 2025 · 0 comments

Comments

@sbleon
Copy link

sbleon commented Jan 21, 2025

After installing this gem and using it to install esbuild, the build stage of the Dockerfile doesn't have the tools needed to precompile assets. Here's the error I got:

 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
 1.342 bin/rails aborted!
 1.342 jsbundling-rails: Command install failed, ensure yarn is installed
 1.370 
 1.370 Tasks: TOP => assets:precompile => javascript:build => javascript:install
 1.370 (See full trace by running task with --trace)
 ERROR: process "/bin/sh -c SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile" did not complete successfully: exit code: 1

I was able to resolve this issue by adding the following to the build stage of the Kamal-generated Dockerfile after the apt-get install build-essential step.

RUN curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh && \
    bash nodesource_setup.sh
RUN apt-get install -y nodejs
RUN npm install --global yarn

I don't know if this is something that is generalizable, or if it is needed for all of the various bundlers. But, I suspect that other folks will run into this error and might not have the Docker knowledge needed to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant