Jay
Joined
Activity
For any other folks out there struggling with this problem, in my case it turned out to be a docker issue.
- On Docker desktop, Settings > General
- Select
gRPC FUSE
instead ofVirtioFS
, which I believe is the default - Uncheck
Use Virtualization framework
Open a new terminal tab, and build again:
docker build --no-cache -t blog .
Hi! I'm having a little trouble with building a docker image for an out-of-the-box rails app. It's failing with the error below (cssbundling-rails: Command build failed, ensure yarn build:css runs without errors
), although yarn build:css
does in fact work without errors. The Dockerfile is generated by Rails with no changes, but it's here for reference.
Is it expected that a person would be able to build a Docker image from the default Rails Dockerfile without any further configuration?
Thanks! Details below.
-> ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin23]
-> rails --version
Rails 7.1.1
-> yarn --version
1.22.19
-> rails new bookstore -d postgresql -c bootstrap
[stuff happens]
-> cd bookstore
-> docker build -t bookstore .
Some log messages removed, but it fails with the following error:
=> [build 8/9] RUN bundle exec bootsnap precompile app/ lib/ 0.8s
=> ERROR [build 9/9] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile 4.7s
------
> [build 9/9] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile:
1.488 yarn install v1.22.19
1.547 [1/4] Resolving packages...
1.618 success Already up-to-date.
1.627 Done in 0.14s.
1.830 yarn run v1.22.19
1.897 $ yarn build:css:compile && yarn build:css:prefix
2.170 $ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
4.509 $ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css
4.595 Segmentation fault
4.609 error Command failed with exit code 139.
4.609 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
4.635 error Command failed with exit code 139.
4.635 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
4.650 bin/rails aborted!
4.650 cssbundling-rails: Command build failed, ensure `yarn build:css` runs without errors
4.650
4.650 Tasks: TOP => assets:precompile => css:build
4.650 (See full trace by running task with --trace)
------
Dockerfile:50
--------------------
48 |
49 | # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
50 | >>> RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
51 |
52 |
--------------------
However, yarn build:css
seems to run fine:
-> yarn run v1.22.19
warning ../package.json: No license field
$ yarn build:css:compile && yarn build:css:prefix
warning ../package.json: No license field
$ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
warning ../package.json: No license field
$ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css
✨ Done in 3.44s.
As does SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
-> SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
yarn install v1.22.19
warning ../package.json: No license field
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.17s.
yarn run v1.22.19
warning ../package.json: No license field
$ yarn build:css:compile && yarn build:css:prefix
warning ../package.json: No license field
$ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
warning ../package.json: No license field
$ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css
✨ Done in 4.52s.