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

Bootsnap causes kamal setup to hang in Ruby 3.3.5 #495

Open
iiewad opened this issue Nov 26, 2024 · 3 comments
Open

Bootsnap causes kamal setup to hang in Ruby 3.3.5 #495

iiewad opened this issue Nov 26, 2024 · 3 comments

Comments

@iiewad
Copy link

iiewad commented Nov 26, 2024

I have a new Rails app, There are some env

ruby 3.3.5
rails 8.0.0
kamal 2.3.0

Dockerfile

# Install application gems
RUN bundle install
RUN rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
RUN rm -rf tmp/cache/bootsnap*
RUN bundle exec bootsnap precompile --gemfile

# Copy application code
COPY . .

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/

# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

When I run kamal setup

 DEBUG [c688ef86]       #15 /bin/sh -c bundle install
 DEBUG [c688ef86]       #15 CACHED
 DEBUG [c688ef86]
 DEBUG [c688ef86]       #16 /bin/sh -c rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
 DEBUG [c688ef86]       #16 CACHED
 DEBUG [c688ef86]
 DEBUG [c688ef86]       #17 /bin/sh -c rm -rf tmp/cache/bootsnap*
 DEBUG [c688ef86]       #17 CACHED
 DEBUG [c688ef86]
 DEBUG [c688ef86]       #18 /bin/sh -c bundle exec bootsnap precompile --gemfile
@iiewad
Copy link
Author

iiewad commented Nov 26, 2024

I changed ruby version to 3.2.5. bootsnap precompile is ok!

@mattgibson
Copy link

Same issue using Ruby 3.3.6 and Rails 8.0.1.

I'm on an Intel mac and the build works if I leave the architecture as default. When targeting arm64 however, it hangs with no output from bootsnap.

Steps to reproduce

  1. Install Ruby 3.3.6
  2. install rails 8.0.1 gem with gem install rails
  3. rails new docker_test
  4. cd docker_test
  5. docker buildx build --platform linux/arm64 .

Expected:
The docker build completes with no errors.
Actual:
Docker build hangs with the output from bundle install as the last lines on the console.

If I use docker buildx build . then it works fine.

The problematic line in the dockerfile is:

RUN bundle install && \
    rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
    bundle exec bootsnap precompile --gemfile

Breaking it apart into this shows that it's bootsnap, but gives no ouput:

RUN bundle install
RUN rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
RUN bundle exec bootsnap precompile --gemfile --verbose

@mattgibson
Copy link

Switching to Ruby 3.2.6 fixes it for me too

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

2 participants