Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

v4 not building in x86_64 container built on arm64 mac #497

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

Closed
BaylorRae opened this issue Feb 10, 2025 · 27 comments
Closed

v4 not building in x86_64 container built on arm64 mac #497

BaylorRae opened this issue Feb 10, 2025 · 27 comments
Labels
needs-more-info Further information is needed to unblock

Comments

@BaylorRae
Copy link

I'm not sure where to post this because I cannot tell if it's kamal, tailwindcss-ruby, or tailwindcss-rails that's the underlying issue.

When running kamal deploy on a new project I'm getting the following error when precompiling assets.

#17 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
#17 5.595 error: File not found: "/rails/app/assets/tailwind/application.css"
#17 5.600 bin/rails aborted!
#17 5.600 Command failed with exit 1: /usr/local/bundle/ruby/3.3.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss
#17 5.612
#17 5.612 Tasks: TOP => assets:precompile => tailwindcss:build
#17 5.612 (See full trace by running task with --trace)
#17 ERROR: process "/bin/sh -c SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile" did not complete successfully: exit code: 1

Inspecting the image I can confirm the file is present but I've not been able to make progress to understand what's failing or find anyone with a similar issue.

Interestingly the build is completing when I run docker build -t app-name . by hand on my macos architecture.

Finally, I'd like to thank y'all for the time you've spent integrating Tailwind into Rails. I've been using Tailwind since v2 and these latest gems and install have been the best to work with yet. Thank you and keep up the great work.

@flavorjones
Copy link
Member

@BaylorRae most likely your application's tailwind configuration is referencing a tailwind plugin that requires installation via npm (or another javascript package manager).

I can't be sure or help more without additional information.

  • what is the content of app/assets/tailwind/application.css
  • if you have one (from a v3 upgrade), what is the content of config/tailwind.config.js

@BaylorRae
Copy link
Author

Thank you, here's my application.css and I don't have a tailwind.config.js

@import "tailwindcss";

@utility table {
  @apply w-full;

  thead {
    @apply text-left;
  }

  tbody {
    @apply divide-y divide-stone-200 border-t-2 border-stone-200;
  }

  thead th,
  tbody td {
    @apply p-4;

    &:first-child {
      @apply pl-0;
    }

    &:last-child {
      @apply pr-0;
    }
  }
}

@BaylorRae
Copy link
Author

The application is a new rails app that was created with the following command.

$ rails new just_believe_training -T --css=tailwind

# Ruby:  3.3.3
# Rails: 8.0.1
# $ cat Gemfile
source "https://rubygems.org"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.0.1"
gem "net-pop", github: "ruby/net-pop"

# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "propshaft"
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 2.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem "importmap-rails"
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails"
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails"
# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
gem "tailwindcss-rails", "~> 4.0"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ windows jruby ]

# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
gem "solid_cache"
gem "solid_queue"
gem "solid_cable"

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
gem "kamal", require: false

# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
gem "thruster", require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
gem "image_processing", "~> 1.13"

group :development, :test do
  # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
  gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"

  # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
  gem "brakeman", require: false

  # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
  gem "rubocop-rails-omakase", require: false
end

group :development do
  # Use console on exceptions pages [https://github.com/rails/web-console]
  gem "web-console"
end

@dmarczal
Copy link

dmarczal commented Feb 10, 2025

Hello, I have the same error run locally

bundle exec rails tailwindcss:build
bin/rails aborted!
Command failed with exit 1: /home/marczal/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss

Tasks: TOP => tailwindcss:build

Any suggestions?

@flavorjones
Copy link
Member

@dmarczal Try running rails tailwindcss:build[verbose], which will output command arguments like this:

["/home/flavorjones/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss", "-i", "/home/flavorjones/code/oss/tailwindcss-rails/My Workspace/test-install/app/assets/tailwind/application.css", "-o", "/home/flavorjones/code/oss/tailwindcss-rails/My Workspace/test-install/app/assets/builds/tailwind.css", "--minify"]

Grab the executable path and run it with --help, does it run and output the tailwind help message?

Reassemble the command from those arguments, does it run or does it emit a more verbose error than you're getting above?

@stage-rl
Copy link

stage-rl commented Feb 11, 2025

Hi, same problem on github actions building on arm64:

#19 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
#19 53.21 error: File not found: "/rails/app/assets/tailwind/application.css"
#19 53.75 bin/rails aborted!
#19 53.76 Command failed with exit 1: /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-aarch64-linux-gnu/exe/aarch64-linux-gnu/tailwindcss

File is there, local image build successful.

@flavorjones
Copy link
Member

flavorjones commented Feb 11, 2025

@stage-rl @dmarczal @BaylorRae If someone can help me reproduce what you're seeing, I would be happy to investigate further. To date I have not been able to guess at the combination of factors causing this. Please provide more information (or a project repository) to help me reproduce it! 🙏

@flavorjones
Copy link
Member

flavorjones commented Feb 11, 2025

Here's what I've done in an attempt to reproduce this:

  1. rails new just_believe_training -T --css=tailwind (see comment)
  2. set contents of app/assets/tailwind/application.css as specified in comment
  3. docker build . runs fine
  4. bin/kamal build dev runs fine
  5. bin/kamal build push --output=docker runs fine

When I say "runs fine" I mean the container build completes, including assets:precompile which builds tailwind, e.g.:

 DEBUG [0c5c81bd]       #15 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
 DEBUG [0c5c81bd]       #15 0.787 ≈ tailwindcss v4.0.6
 DEBUG [0c5c81bd]       #15 0.787
 DEBUG [0c5c81bd]       #15 0.787 Done in 62ms
 DEBUG [0c5c81bd]       #15 0.824 Writing tailwind-870644cd.css
 DEBUG [0c5c81bd]       #15 0.824 Writing application-8b441ae0.css
 DEBUG [0c5c81bd]       #15 0.824 Writing application-bfcdf840.js
 DEBUG [0c5c81bd]       #15 0.824 Writing controllers/application-3affb389.js
 DEBUG [0c5c81bd]       #15 0.824 Writing controllers/hello_controller-708796bd.js
 DEBUG [0c5c81bd]       #15 0.824 Writing controllers/index-ee64e1f1.js
 DEBUG [0c5c81bd]       #15 0.824 Writing stimulus-d59b3b7f.js
 DEBUG [0c5c81bd]       #15 0.824 Writing stimulus-autoloader-9d447422.js
 DEBUG [0c5c81bd]       #15 0.824 Writing stimulus-importmap-autoloader-64cc03e1.js
 DEBUG [0c5c81bd]       #15 0.824 Writing stimulus-loading-1fc53fe7.js
 DEBUG [0c5c81bd]       #15 0.824 Writing stimulus.min-4b1e420e.js
 DEBUG [0c5c81bd]       #15 0.824 Writing stimulus.min-2395e199.js.map
 DEBUG [0c5c81bd]       #15 0.824 Writing turbo.min-fae85750.js
 DEBUG [0c5c81bd]       #15 0.824 Writing turbo.min-5dd5a71a.js.map
 DEBUG [0c5c81bd]       #15 0.824 Writing turbo-86e38c3c.js
 DEBUG [0c5c81bd]       #15 0.824 Writing actioncable-ac25813f.js
 DEBUG [0c5c81bd]       #15 0.824 Writing actioncable.esm-e0ec9819.js
 DEBUG [0c5c81bd]       #15 0.824 Writing action_cable-5212cfee.js
 DEBUG [0c5c81bd]       #15 0.824 Writing trix-0d050b00.js
 DEBUG [0c5c81bd]       #15 0.824 Writing actiontext-a4ee937e.js
 DEBUG [0c5c81bd]       #15 0.824 Writing actiontext.esm-f1c04d34.js
 DEBUG [0c5c81bd]       #15 0.824 Writing trix-c4e7be2d.css
 DEBUG [0c5c81bd]       #15 0.824 Writing activestorage.esm-f2909226.js
 DEBUG [0c5c81bd]       #15 0.824 Writing activestorage-32201f68.js
 DEBUG [0c5c81bd]       #15 0.824 Writing rails-ujs-20eaf715.js
 DEBUG [0c5c81bd]       #15 0.824 Writing rails-ujs.esm-e925103b.js
 DEBUG [0c5c81bd]       #15 DONE 0.9s
 DEBUG [0c5c81bd]

I'm on

  • Linux bepi 6.11.0-1004-lowlatency #4-Ubuntu SMP PREEMPT_DYNAMIC Mon Sep 30 10:54:09 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • running ruby 3.4.1
    • tailwindcss-rails (4.0.0)
    • tailwindcss-ruby (4.0.6)
    • rails (8.0.1)

What are y'all doing differently?

@stage-rl
Copy link

@flavorjones granted you my repo. See the dedicated tailwind v4 branch

@flavorjones
Copy link
Member

flavorjones commented Feb 11, 2025

@stage-rl I cannot reproduce in your repo.

  • cloned repo
  • switched to tailwind_v4 branch (HEAD commit is 8831f261)
  • ran docker build -t issue-tailwindcss-rails-497-efectfit .

Output included:

#17 [build 6/6] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
#17 1.286 ≈ tailwindcss v4.0.6
#17 1.286
#17 1.286 Done in 179ms
#17 1.682 I, [2025-02-11T20:29:03.752492 #7]  INFO -- : Writing /rails/public/assets/manifest-2f0ac84ec540eb753a59078be1e78cb9bb00e12a9a8d6d826039a818a0008610.js
#17 1.684 I, [2025-02-11T20:29:03.754530 #7]  INFO -- : Writing /rails/public/assets/manifest-2f0ac84ec540eb753a59078be1e78cb9bb00e12a9a8d6d826039a818a0008610.js.gz
#17 1.685 I, [2025-02-11T20:29:03.755117 #7]  INFO -- : Writing /rails/public/assets/application-8214855a108a99cf7c3db0d8da6146d3b0e789465fa3569bb29688e1938322bc.css
#17 1.686 I, [2025-02-11T20:29:03.755940 #7]  INFO -- : Writing /rails/public/assets/application-8214855a108a99cf7c3db0d8da6146d3b0e789465fa3569bb29688e1938322bc.css.gz
#17 1.687 I, [2025-02-11T20:29:03.756906 #7]  INFO -- : Writing /rails/public/assets/application-7653e000cc51a82041872bd6aa8091f0099e9b95db0769b1e70df8916f8fa1a0.js
#17 1.688 I, [2025-02-11T20:29:03.758004 #7]  INFO -- : Writing /rails/public/assets/application-7653e000cc51a82041872bd6aa8091f0099e9b95db0769b1e70df8916f8fa1a0.js.gz
#17 1.689 I, [2025-02-11T20:29:03.759278 #7]  INFO -- : Writing /rails/public/assets/controllers/application-368d98631bccbf2349e0d4f8269afb3fe9625118341966de054759d96ea86c7e.js
#17 1.690 I, [2025-02-11T20:29:03.760269 #7]  INFO -- : Writing /rails/public/assets/controllers/application-368d98631bccbf2349e0d4f8269afb3fe9625118341966de054759d96ea86c7e.js.gz
#17 1.692 I, [2025-02-11T20:29:03.761880 #7]  INFO -- : Writing /rails/public/assets/controllers/index-119fad9e0503eb4359d76d77249cb804e097f5d0c1d6fca03446f1485c1a57a9.js
#17 1.692 I, [2025-02-11T20:29:03.762737 #7]  INFO -- : Writing /rails/public/assets/controllers/index-119fad9e0503eb4359d76d77249cb804e097f5d0c1d6fca03446f1485c1a57a9.js.gz
#17 1.693 I, [2025-02-11T20:29:03.762959 #7]  INFO -- : Writing /rails/public/assets/controllers/push_controller-eedf0e927bd0aa000f6ff43d4f1086a3fdc65b3babe83770e7bd0f165a50c42b.js
#17 1.693 I, [2025-02-11T20:29:03.763129 #7]  INFO -- : Writing /rails/public/assets/controllers/push_controller-eedf0e927bd0aa000f6ff43d4f1086a3fdc65b3babe83770e7bd0f165a50c42b.js.gz
#17 1.693 I, [2025-02-11T20:29:03.763331 #7]  INFO -- : Writing /rails/public/assets/controllers/swiper_controller-5f6fca2c584fe749294dfd7742004cf476ba8582c8d756f8e6a9e6f5dbba68b6.js
#17 1.694 I, [2025-02-11T20:29:03.764710 #7]  INFO -- : Writing /rails/public/assets/controllers/swiper_controller-5f6fca2c584fe749294dfd7742004cf476ba8582c8d756f8e6a9e6f5dbba68b6.js.gz
#17 1.695 I, [2025-02-11T20:29:03.764961 #7]  INFO -- : Writing /rails/public/assets/flowbite/plugin-ac2a0c356fe2707e7d7d2459506867c58f8f1d2bdf8741583d48a25b78bdf4a9.js
#17 1.698 I, [2025-02-11T20:29:03.768531 #7]  INFO -- : Writing /rails/public/assets/flowbite/plugin-ac2a0c356fe2707e7d7d2459506867c58f8f1d2bdf8741583d48a25b78bdf4a9.js.gz
#17 1.705 I, [2025-02-11T20:29:03.773676 #7]  INFO -- : Writing /rails/public/assets/tailwind-f9e613550cf29ce16d6648117b58c01891c4aadd778df6cc8e916fcdaf40bbdf.css
#17 1.707 I, [2025-02-11T20:29:03.777374 #7]  INFO -- : Writing /rails/public/assets/tailwind-f9e613550cf29ce16d6648117b58c01891c4aadd778df6cc8e916fcdaf40bbdf.css.gz
#17 1.708 I, [2025-02-11T20:29:03.777940 #7]  INFO -- : Writing /rails/public/assets/turbo-a6b3a37c3dae2061186942401d1053a3aaeb51c3ba30fa12fa3d7f56f4dfe6de.js
#17 1.708 I, [2025-02-11T20:29:03.778424 #7]  INFO -- : Writing /rails/public/assets/turbo-a6b3a37c3dae2061186942401d1053a3aaeb51c3ba30fa12fa3d7f56f4dfe6de.js.gz
#17 1.712 I, [2025-02-11T20:29:03.782232 #7]  INFO -- : Writing /rails/public/assets/turbo.min-4cfe7c6aaeb9120821760aa53763dff54fbc561e500da6482fc43c54c7384929.js
#17 1.712 I, [2025-02-11T20:29:03.782725 #7]  INFO -- : Writing /rails/public/assets/turbo.min-4cfe7c6aaeb9120821760aa53763dff54fbc561e500da6482fc43c54c7384929.js.gz
#17 1.716 I, [2025-02-11T20:29:03.786373 #7]  INFO -- : Writing /rails/public/assets/turbo.min.js-425ee54ee541e22118661e6f1bde8f4159c7f6cebf39acc1b648cb85af6a197c.map
#17 1.717 I, [2025-02-11T20:29:03.787378 #7]  INFO -- : Writing /rails/public/assets/turbo.min.js-425ee54ee541e22118661e6f1bde8f4159c7f6cebf39acc1b648cb85af6a197c.map.gz
#17 1.717 I, [2025-02-11T20:29:03.787673 #7]  INFO -- : Writing /rails/public/assets/actiontext-0bc07717019da448e4a7abda9b2718ef0a4a8399bc1949280d76e308a795be6e.js
#17 1.718 I, [2025-02-11T20:29:03.788004 #7]  INFO -- : Writing /rails/public/assets/actiontext-0bc07717019da448e4a7abda9b2718ef0a4a8399bc1949280d76e308a795be6e.js.gz
#17 1.718 I, [2025-02-11T20:29:03.788256 #7]  INFO -- : Writing /rails/public/assets/actiontext.esm-8386a561a026b3cbe8b226bf99965ba3e0d76c7ac6c97ef80a5dfec240795708.js
#17 1.719 I, [2025-02-11T20:29:03.789126 #7]  INFO -- : Writing /rails/public/assets/actiontext.esm-8386a561a026b3cbe8b226bf99965ba3e0d76c7ac6c97ef80a5dfec240795708.js.gz
#17 1.720 I, [2025-02-11T20:29:03.790228 #7]  INFO -- : Writing /rails/public/assets/trix-b6d103912a6c8078fed14e45716425fb78de5abfbe7b626cd5d9b25b35265066.js
#17 1.724 I, [2025-02-11T20:29:03.794129 #7]  INFO -- : Writing /rails/public/assets/trix-b6d103912a6c8078fed14e45716425fb78de5abfbe7b626cd5d9b25b35265066.js.gz
#17 1.727 I, [2025-02-11T20:29:03.796935 #7]  INFO -- : Writing /rails/public/assets/trix-5fc7656c4bff8fe505ff90fda4bc9409db4447ada6efcc1204914dc782c6066c.css
#17 1.728 I, [2025-02-11T20:29:03.798307 #7]  INFO -- : Writing /rails/public/assets/trix-5fc7656c4bff8fe505ff90fda4bc9409db4447ada6efcc1204914dc782c6066c.css.gz
#17 1.728 I, [2025-02-11T20:29:03.798729 #7]  INFO -- : Writing /rails/public/assets/stimulus-f75215805563870a61ee9dc5a207ce46d4675c7e667558a54344fd1e7baa697f.js
#17 1.729 I, [2025-02-11T20:29:03.799472 #7]  INFO -- : Writing /rails/public/assets/stimulus-f75215805563870a61ee9dc5a207ce46d4675c7e667558a54344fd1e7baa697f.js.gz
#17 1.730 I, [2025-02-11T20:29:03.800443 #7]  INFO -- : Writing /rails/public/assets/stimulus-autoloader-c584942b568ba74879da31c7c3d51366737bacaf6fbae659383c0a5653685693.js
#17 1.731 I, [2025-02-11T20:29:03.801536 #7]  INFO -- : Writing /rails/public/assets/stimulus-autoloader-c584942b568ba74879da31c7c3d51366737bacaf6fbae659383c0a5653685693.js.gz
#17 1.732 I, [2025-02-11T20:29:03.801997 #7]  INFO -- : Writing /rails/public/assets/stimulus-importmap-autoloader-db2076c783bf2dbee1226e2add52fef290b5d31b5bcd1edd999ac8a6dd31c44a.js
#17 1.732 I, [2025-02-11T20:29:03.802327 #7]  INFO -- : Writing /rails/public/assets/stimulus-importmap-autoloader-db2076c783bf2dbee1226e2add52fef290b5d31b5bcd1edd999ac8a6dd31c44a.js.gz
#17 1.732 I, [2025-02-11T20:29:03.802562 #7]  INFO -- : Writing /rails/public/assets/stimulus-loading-3576ce92b149ad5d6959438c6f291e2426c86df3b874c525b30faad51b0d96b3.js
#17 1.732 I, [2025-02-11T20:29:03.802852 #7]  INFO -- : Writing /rails/public/assets/stimulus-loading-3576ce92b149ad5d6959438c6f291e2426c86df3b874c525b30faad51b0d96b3.js.gz
#17 1.733 I, [2025-02-11T20:29:03.803065 #7]  INFO -- : Writing /rails/public/assets/stimulus.min-dd364f16ec9504dfb72672295637a1c8838773b01c0b441bd41008124c407894.js
#17 1.733 I, [2025-02-11T20:29:03.803274 #7]  INFO -- : Writing /rails/public/assets/stimulus.min-dd364f16ec9504dfb72672295637a1c8838773b01c0b441bd41008124c407894.js.gz
#17 1.734 I, [2025-02-11T20:29:03.804510 #7]  INFO -- : Writing /rails/public/assets/stimulus-autoloader-c584942b568ba74879da31c7c3d51366737bacaf6fbae659383c0a5653685693.js.gz
#17 1.735 I, [2025-02-11T20:29:03.805281 #7]  INFO -- : Writing /rails/public/assets/stimulus-importmap-autoloader-db2076c783bf2dbee1226e2add52fef290b5d31b5bcd1edd999ac8a6dd31c44a.js.gz
#17 1.735 I, [2025-02-11T20:29:03.805808 #7]  INFO -- : Writing /rails/public/assets/stimulus-loading-3576ce92b149ad5d6959438c6f291e2426c86df3b874c525b30faad51b0d96b3.js.gz
#17 1.736 I, [2025-02-11T20:29:03.806271 #7]  INFO -- : Writing /rails/public/assets/stimulus.min.js-2cc63625fa177963b45da974806e7aee846cbf1d4930815733d0fdf3fb232325.map
#17 1.736 I, [2025-02-11T20:29:03.806701 #7]  INFO -- : Writing /rails/public/assets/stimulus.min.js-2cc63625fa177963b45da974806e7aee846cbf1d4930815733d0fdf3fb232325.map.gz
#17 1.737 I, [2025-02-11T20:29:03.807137 #7]  INFO -- : Writing /rails/public/assets/activestorage-b739665c00c484e89aa1fbed0f6c6956e04e31da358a7661a16fea46775b3cc2.js
#17 1.737 I, [2025-02-11T20:29:03.807462 #7]  INFO -- : Writing /rails/public/assets/activestorage-b739665c00c484e89aa1fbed0f6c6956e04e31da358a7661a16fea46775b3cc2.js.gz
#17 1.737 I, [2025-02-11T20:29:03.807758 #7]  INFO -- : Writing /rails/public/assets/activestorage.esm-67701f2a2743709337889a5447ee87325b56054627c1b736725d69f247f79992.js
#17 1.738 I, [2025-02-11T20:29:03.808112 #7]  INFO -- : Writing /rails/public/assets/activestorage.esm-67701f2a2743709337889a5447ee87325b56054627c1b736725d69f247f79992.js.gz
#17 1.738 I, [2025-02-11T20:29:03.808624 #7]  INFO -- : Writing /rails/public/assets/actioncable-323d156a10054ee2c94ba8a17c20458f542a17234f934ea53d16e0e1899fda5e.js
#17 1.739 I, [2025-02-11T20:29:03.809321 #7]  INFO -- : Writing /rails/public/assets/actioncable-323d156a10054ee2c94ba8a17c20458f542a17234f934ea53d16e0e1899fda5e.js.gz
#17 1.740 I, [2025-02-11T20:29:03.809905 #7]  INFO -- : Writing /rails/public/assets/actioncable.esm-b66d83871f0a453b10ba8b4c147c2bafa655caaa5d13fa34e9bf361c1c2aedb7.js
#17 1.740 I, [2025-02-11T20:29:03.810233 #7]  INFO -- : Writing /rails/public/assets/actioncable.esm-b66d83871f0a453b10ba8b4c147c2bafa655caaa5d13fa34e9bf361c1c2aedb7.js.gz
#17 DONE 1.8s

I notice that my docker build step is 17 while yours is 19. Help me reproduce what you're seeing.

@stage-rl
Copy link

As I said, locally it's also OK on my computer. But see the failed workflow:

https://github.com/stage-rl/efectfit/actions/runs/13248836256/job/36981687456

@flavorjones
Copy link
Member

I see the failed workflow. Unfortunately, that doesn't help me reproduce it so I can debug it, though. I'd like to ask the folks who've posted on this issue to help me reproduce it locally so I don't have to guess at the preconditions that trigger whatever is going on.

@stage-rl
Copy link

Hm, I don't know how to help. OK, thanks a lot for the effort. Hopefully someone else will be more knowledgeable than myself

@flavorjones flavorjones added the needs-more-info Further information is needed to unblock label Feb 11, 2025
@Adham2023
Copy link

Hm, I don't know how to help. OK, thanks a lot for the effort. Hopefully someone else will be more knowledgeable than myself

Are you running apple sillicon chip? My project is working in development, but can't deploy it to my Ubunut, but if I use my ubunto PC then It is working normally.

@BaylorRae
Copy link
Author

Hm, I don't know how to help. OK, thanks a lot for the effort. Hopefully someone else will be more knowledgeable than myself

Are you running apple sillicon chip? My project is working in development, but can't deploy it to my Ubunut, but if I use my ubunto PC then It is working normally.

This is my setup as well. I'll go back through the thread more closely when I'm back at my computer, but skimming through the comments we are seeing the same things.

I'm on a M1 chip I believe and can run docker build and it works but fails when running docker deploy.

To fix my issue I ended up uninstalling the tailwindcss-rails gem, adding node to my dockerfile, and manually compiling the css into my assets/builds directory.

I can't remember for certain, but I think when started a vanilla ruby-slim container that I was able to install the tailwindcss gem and have it work when I ran it by hand. It seems like it was at the asset pipeline level in rails that was causing issues. I wish I could be certain but I tried several different combinations of node/no-node etc..

It might be propshaft but I didn't take the time to try everything against sprockets.

@jtarchie
Copy link

I was able to recreate it on a Mac M-series machine with the following instructions.

rails new --minimal -c tailwind Testing
cd Testing/
docker buildx build --platform linux/amd64 .

The output:

 > [build 5/5] RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile:
3.919 error: File not found: "/rails/app/assets/tailwind/application.css"
3.923 bin/rails aborted!
3.923 Command failed with exit 1: /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss
3.934
3.934 Tasks: TOP => assets:precompile => tailwindcss:build
3.934 (See full trace by running task with --trace)
------
Dockerfile:45

I tried adding the command to the Dockerfule.

RUN RAILS_MASTER_KEY="asdf" SECRET_KEY_BASE_DUMMY=1 ./bin/rails tailwindcss:build[verbose]
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile

With the output that failed with:

3.828 ["/usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss", "-i", "/rails/app/assets/tailwind/application.css", "-o", "/rails/app/assets/builds/tailwind.css", "--minify"]
3.857 error: File not found: "/rails/app/assets/tailwind/application.css"
3.860 bin/rails aborted!
3.860 Command failed with exit 1: /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss
3.870 
3.870 Tasks: TOP => tailwindcss:build
3.870 (See full trace by running task with --trace)

@flavorjones
Copy link
Member

I don't have a mac, so I can't reproduce this. I need someone's further help to determine if the problem is with this gem, or with the upstream binary running in docker (and I'm quite sure it's the latter, but before opening a bug report upstream we need to positively determine this).

As I asked a few days ago in #497 (comment) ...

Try running rails tailwindcss:build[verbose] in the contain, which will output command arguments like this:

["/home/flavorjones/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss", "-i", "/home/flavorjones/code/oss/tailwindcss-rails/My Workspace/test-install/app/assets/tailwind/application.css", "-o", "/home/flavorjones/code/oss/tailwindcss-rails/My Workspace/test-install/app/assets/builds/tailwind.css", "--minify"]

Grab the executable path and run it with --help, does it run and output the tailwind help message?

Reassemble the command from those arguments, does it run? Does it emit a more verbose error than you're getting above?

@flavorjones
Copy link
Member

Like, just as a reminder, this gem (tailwindcss-rails) mostly provides view templates and rails-compatible config files. The tailwindcss-ruby gem just packages up the upstream binary executable.

Problems like what's reported here are not likely to be caused by or under the control of either of the Ruby gems, which is why I keep asking people on this thread and other reports to run the binary executable directly to determine if it works and validate my hypothesis that this is a problem with the upstream binary.

@jtarchie
Copy link

The previous comment does have your request output. I didn't highlight it well enough.

Here is the output from ./bin/rails tailwindcss:build[verbose]:

["/usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss", "-i", "/rails/app/assets/tailwind/application.css", "-o", "/rails/app/assets/builds/tailwind.css", "--minify"]
error: File not found: "/rails/app/assets/tailwind/application.css"
bin/rails aborted!
Command failed with exit 1: /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss

@flavorjones
Copy link
Member

@jtarchie now run that command without invoking the gem's rake task, please

@flavorjones
Copy link
Member

I am trying to get someone to provide a repro that can be reported upstream. To do that we need to run the binary executable directly on a directory/file structure that is reproducible by upstream tailwind maintainers who likely know nothing about ruby or rails.

@jtarchie
Copy link

Adding the line RUN bundle exec tailwindcss -h to the Dockerfile does work. I'm unable to get the stdout, however, because docker build suppresses the output if nothing went wrong.

I cheated an added a && exit 1 to get the output.

 > [build 5/5] RUN bundle exec tailwindcss -h && exit 1:
0.274 ≈ tailwindcss v4.0.6
0.274 
0.274 Usage:
0.274   tailwindcss [--input input.css] [--output output.css] [--watch] [options…]
0.274 
0.274 Options:
0.274   -i, --input ··········· Input file
0.274   -o, --output ·········· Output file [default: `-`]
0.275   -w, --watch ··········· Watch for changes and rebuild as needed
0.275   -m, --minify ·········· Optimize and minify the output
0.275       --optimize ········ Optimize the output without minifying
0.275       --cwd ············· The current working directory [default: `.`]
0.275   -h, --help ············ Display usage information

@flavorjones
Copy link
Member

@jtarchie I'm asking you to run the build command implied by the verbose output

@flavorjones
Copy link
Member

this command:

/usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss -i /rails/app/assets/tailwind/application.css -o /rails/app/assets/builds/tailwind.css --minify

@jtarchie
Copy link

Ok, here we go, thanks for clarifying. I took some extra liberty to get information about the missing file it appears to complain about.

The commands added:

RUN ls -asl /rails/app/assets/tailwind/
RUN /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss -i /rails/app/assets/tailwind/application.css -o /rails/app/assets/builds/tailwind.css --minify

Output:

 > [build 5/6] RUN ls -asl /rails/app/assets/tailwind/:
0.097 total 12
0.097 4 drwxr-xr-x 2 root root 4096 Feb 12 03:28 .
0.097 4 drwxr-xr-x 6 root root 4096 Feb 12 03:28 ..
0.097 4 -rw-r--r-- 1 root root   23 Feb 12 03:28 application.css

 > [build 6/6] RUN /usr/local/bundle/ruby/3.4.0/gems/tailwindcss-ruby-4.0.6-x86_64-linux-gnu/exe/x86_64-linux-gnu/tailwindcss -i /rails/app/assets/tailwind/application.css -o /rails/app/assets/builds/tailwind.css --minify:
0.106 error: File not found: "/rails/app/assets/tailwind/application.css"

I wanted to show the information on the files in the /rails/app/assets/tailwind directory.

@flavorjones
Copy link
Member

flavorjones commented Feb 12, 2025

This is great, thank you for following this through to the end, @jtarchie.

This demonstrates to me that the binary executable is behaving strangely in an x86_64 docker container that is built on an arm64 darwin host. Do you agree, does that fully describe the preconditions?

If so am willing to attempt to report this upstream, though I would prefer if a Mac user reported it instead in order to help debug/diagnose with upstream maintainers.

@flavorjones flavorjones changed the title v4 not building with kamal deploy v4 not building in x86_64 container built on arm64 mac Feb 12, 2025
@flavorjones
Copy link
Member

Side note, anyone kamal-deploying to x86_64 production platforms but developing on an arm64 platform should consider setting up a remote builder:

https://kamal-deploy.org/docs/configuration/builder-examples/

@rails rails locked and limited conversation to collaborators Feb 12, 2025
@flavorjones flavorjones converted this issue into discussion #499 Feb 12, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
needs-more-info Further information is needed to unblock
Projects
None yet
Development

No branches or pull requests

6 participants