title: Docker Buildx missing files in building arm 64 rails image
body: <p>I am trying to build a arm64 image on a x64 linux os. The 64 bit version using docker build . ... works perfectly. On the docker buildx version though, I am missing several configuration files causing the deploy to fail.</p>
  <p>The app is a rails app with webpacker. The missing files I've found so far are <code>config/webpacker.yml</code> and <code>config/webpack/</code>, and <code>app/javascript/*</code>.</p>
  <p>Dockerfile:</p>
  <pre><code>FROM ruby:3.0.3-slim-bullseye
  
  RUN apt-get update -qq &amp;&amp;\
    apt install curl -y 
  
  RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &amp;&amp;\
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &amp;&amp;\
    echo &quot;deb https://dl.yarnpkg.com/debian/ stable main&quot; | tee /etc/apt/sources.list.d/yarn.list &amp;&amp;\
    apt-get update -qq &amp;&amp;\
    apt-get install -y nodejs yarn \
    build-essential \
    libpq-dev libsqlite3-dev
  
  RUN useradd --user-group --create-home --shell /bin/false app
  ENV HOME=/home/app
  USER app
  
  WORKDIR $HOME/wedding
  COPY --chown=app:app Gemfile ./
  RUN bundle config set --local path 'vendor/bundle' &amp;&amp;\
    bundle install 
  
  COPY --chown=app:app package.json yarn.lock ./
  RUN yarn install
  
  COPY --chown=app:app . .
  RUN bundle exec rake webpacker:compile
  
  # i even tried copying the file manually to no success
  COPY --chown=app:app ./config/webpacker.yml ./config/
  
  EXPOSE 3000
  
  CMD [&quot;bundle&quot;, &quot;exec&quot;, &quot;rails&quot;, &quot;server&quot;, &quot;-b&quot;, &quot;0.0.0.0&quot;]
  </code></pre>
  <p>Docker build command:</p>
  <pre><code>docker buildx build --platform linux/arm64 -t my.registry.com/wedding --load .
  </code></pre>
  <p>Gemfile:</p>
  <pre><code>source &quot;https://rubygems.org&quot;
  git_source(:github) { |repo| &quot;https://github.com/#{repo}.git&quot; }
  
  ruby &quot;3.0.3&quot;
  
  # Bundle edge Rails instead: gem &quot;rails&quot;, github: &quot;rails/rails&quot;, branch: &quot;main&quot;
  gem &quot;rails&quot;, &quot;~&gt; 7.0.1&quot;
  
  # Use sqlite3 as the database for Active Record
  gem &quot;sqlite3&quot;, &quot;~&gt; 1.4&quot;
  
  # Use the Puma web server [https://github.com/puma/puma]
  gem &quot;puma&quot;, &quot;~&gt; 5.0&quot;
  
  # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
  gem &quot;importmap-rails&quot;
  
  # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
  gem &quot;turbo-rails&quot;
  
  # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
  gem &quot;stimulus-rails&quot;
  
  # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
  gem &quot;sprockets-rails&quot;
  
  
  # Build JSON APIs with ease [https://github.com/rails/jbuilder]
  # gem &quot;jbuilder&quot;
  
  # gem 'activeadmin'
  # gem 'devise'
  # gem &quot;auto_strip_attributes&quot;
  # gem &quot;scenic&quot;
  # gem 'scenic_sqlite_adapter'
  
  # gem 'webpacker'
  # gem &quot;sprockets&quot;
  
  # Use Redis adapter to run Action Cable in production
  # gem &quot;redis&quot;, &quot;~&gt; 4.0&quot;
  
  # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
  # gem &quot;kredis&quot;
  
  # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
  # gem &quot;bcrypt&quot;, &quot;~&gt; 3.1.7&quot;
  
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  gem &quot;tzinfo-data&quot;, platforms: %i[ mingw mswin x64_mingw jruby ruby ]
  
  # Reduces boot times through caching; required in config/boot.rb
  gem &quot;bootsnap&quot;, require: false
  
  # Use Sass to process CSS
  # gem &quot;sassc-rails&quot;
  
  # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
  # gem &quot;image_processing&quot;, &quot;~&gt; 1.2&quot;
  
  group :development, :test do
    # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
    gem &quot;debug&quot;, platforms: %i[ mri mingw x64_mingw ]
  end
  
  group :development do
    # Use console on exceptions pages [https://github.com/rails/web-console]
    gem &quot;web-console&quot;
  
    # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
    # gem &quot;rack-mini-profiler&quot;
  
    # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
    # gem &quot;spring&quot;
  end
  
  group :test do
    # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
    gem &quot;capybara&quot;
    gem &quot;selenium-webdriver&quot;
    gem &quot;webdrivers&quot;
  end
  
  gem &quot;activeadmin&quot;, &quot;~&gt; 2.11&quot;
  gem &quot;devise&quot;, &quot;~&gt; 4.8&quot;
  gem &quot;auto_strip_attributes&quot;, &quot;~&gt; 2.6&quot;
  gem &quot;scenic&quot;, &quot;~&gt; 1.6&quot;
  gem &quot;scenic_sqlite_adapter&quot;, &quot;~&gt; 0.1.0&quot;
  gem &quot;webpacker&quot;, &quot;~&gt; 5.4&quot;
  </code></pre>
  <p>Gemfile lock:</p>
  <pre><code>GEM
    remote: https://rubygems.org/
    specs:
      actioncable (7.0.2.3)
        actionpack (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        nio4r (~&gt; 2.0)
        websocket-driver (&gt;= 0.6.1)
      actionmailbox (7.0.2.3)
        actionpack (= 7.0.2.3)
        activejob (= 7.0.2.3)
        activerecord (= 7.0.2.3)
        activestorage (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        mail (&gt;= 2.7.1)
        net-imap
        net-pop
        net-smtp
      actionmailer (7.0.2.3)
        actionpack (= 7.0.2.3)
        actionview (= 7.0.2.3)
        activejob (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        mail (~&gt; 2.5, &gt;= 2.5.4)
        net-imap
        net-pop
        net-smtp
        rails-dom-testing (~&gt; 2.0)
      actionpack (7.0.2.3)
        actionview (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        rack (~&gt; 2.0, &gt;= 2.2.0)
        rack-test (&gt;= 0.6.3)
        rails-dom-testing (~&gt; 2.0)
        rails-html-sanitizer (~&gt; 1.0, &gt;= 1.2.0)
      actiontext (7.0.2.3)
        actionpack (= 7.0.2.3)
        activerecord (= 7.0.2.3)
        activestorage (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        globalid (&gt;= 0.6.0)
        nokogiri (&gt;= 1.8.5)
      actionview (7.0.2.3)
        activesupport (= 7.0.2.3)
        builder (~&gt; 3.1)
        erubi (~&gt; 1.4)
        rails-dom-testing (~&gt; 2.0)
        rails-html-sanitizer (~&gt; 1.1, &gt;= 1.2.0)
      activeadmin (2.11.1)
        arbre (~&gt; 1.2, &gt;= 1.2.1)
        formtastic (&gt;= 3.1, &lt; 5.0)
        formtastic_i18n (~&gt; 0.4)
        inherited_resources (~&gt; 1.7)
        jquery-rails (~&gt; 4.2)
        kaminari (~&gt; 1.0, &gt;= 1.2.1)
        railties (&gt;= 6.0, &lt; 7.1)
        ransack (~&gt; 2.1, &gt;= 2.1.1)
      activejob (7.0.2.3)
        activesupport (= 7.0.2.3)
        globalid (&gt;= 0.3.6)
      activemodel (7.0.2.3)
        activesupport (= 7.0.2.3)
      activerecord (7.0.2.3)
        activemodel (= 7.0.2.3)
        activesupport (= 7.0.2.3)
      activestorage (7.0.2.3)
        actionpack (= 7.0.2.3)
        activejob (= 7.0.2.3)
        activerecord (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        marcel (~&gt; 1.0)
        mini_mime (&gt;= 1.1.0)
      activesupport (7.0.2.3)
        concurrent-ruby (~&gt; 1.0, &gt;= 1.0.2)
        i18n (&gt;= 1.6, &lt; 2)
        minitest (&gt;= 5.1)
        tzinfo (~&gt; 2.0)
      addressable (2.8.0)
        public_suffix (&gt;= 2.0.2, &lt; 5.0)
      arbre (1.5.0)
        activesupport (&gt;= 3.0.0, &lt; 7.1)
        ruby2_keywords (&gt;= 0.0.2, &lt; 1.0)
      auto_strip_attributes (2.6.0)
        activerecord (&gt;= 4.0)
      bcrypt (3.1.17)
      bindex (0.8.1)
      bootsnap (1.11.1)
        msgpack (~&gt; 1.2)
      builder (3.2.4)
      capybara (3.36.0)
        addressable
        matrix
        mini_mime (&gt;= 0.1.3)
        nokogiri (~&gt; 1.8)
        rack (&gt;= 1.6.0)
        rack-test (&gt;= 0.6.3)
        regexp_parser (&gt;= 1.5, &lt; 3.0)
        xpath (~&gt; 3.2)
      childprocess (4.1.0)
      concurrent-ruby (1.1.10)
      crass (1.0.6)
      debug (1.4.0)
        irb (&gt;= 1.3.6)
        reline (&gt;= 0.2.7)
      devise (4.8.1)
        bcrypt (~&gt; 3.0)
        orm_adapter (~&gt; 0.1)
        railties (&gt;= 4.1.0)
        responders
        warden (~&gt; 1.2.3)
      digest (3.1.0)
      erubi (1.10.0)
      formtastic (4.0.0)
        actionpack (&gt;= 5.2.0)
      formtastic_i18n (0.7.0)
      globalid (1.0.0)
        activesupport (&gt;= 5.0)
      has_scope (0.8.0)
        actionpack (&gt;= 5.2)
        activesupport (&gt;= 5.2)
      i18n (1.10.0)
        concurrent-ruby (~&gt; 1.0)
      importmap-rails (1.0.3)
        actionpack (&gt;= 6.0.0)
        railties (&gt;= 6.0.0)
      inherited_resources (1.13.1)
        actionpack (&gt;= 5.2, &lt; 7.1)
        has_scope (~&gt; 0.6)
        railties (&gt;= 5.2, &lt; 7.1)
        responders (&gt;= 2, &lt; 4)
      io-console (0.5.11)
      io-wait (0.2.1)
      irb (1.4.1)
        reline (&gt;= 0.3.0)
      jquery-rails (4.4.0)
        rails-dom-testing (&gt;= 1, &lt; 3)
        railties (&gt;= 4.2.0)
        thor (&gt;= 0.14, &lt; 2.0)
      kaminari (1.2.2)
        activesupport (&gt;= 4.1.0)
        kaminari-actionview (= 1.2.2)
        kaminari-activerecord (= 1.2.2)
        kaminari-core (= 1.2.2)
      kaminari-actionview (1.2.2)
        actionview
        kaminari-core (= 1.2.2)
      kaminari-activerecord (1.2.2)
        activerecord
        kaminari-core (= 1.2.2)
      kaminari-core (1.2.2)
      loofah (2.15.0)
        crass (~&gt; 1.0.2)
        nokogiri (&gt;= 1.5.9)
      mail (2.7.1)
        mini_mime (&gt;= 0.1.1)
      marcel (1.0.2)
      matrix (0.4.2)
      method_source (1.0.0)
      mini_mime (1.1.2)
      minitest (5.15.0)
      msgpack (1.4.5)
      net-imap (0.2.3)
        digest
        net-protocol
        strscan
      net-pop (0.1.1)
        digest
        net-protocol
        timeout
      net-protocol (0.1.2)
        io-wait
        timeout
      net-smtp (0.3.1)
        digest
        net-protocol
        timeout
      nio4r (2.5.8)
      nokogiri (1.13.3-aarch64-linux)
        racc (~&gt; 1.4)
      nokogiri (1.13.3-x86_64-linux)
        racc (~&gt; 1.4)
      orm_adapter (0.5.0)
      public_suffix (4.0.6)
      puma (5.6.2)
        nio4r (~&gt; 2.0)
      racc (1.6.0)
      rack (2.2.3)
      rack-proxy (0.7.2)
        rack
      rack-test (1.1.0)
        rack (&gt;= 1.0, &lt; 3)
      rails (7.0.2.3)
        actioncable (= 7.0.2.3)
        actionmailbox (= 7.0.2.3)
        actionmailer (= 7.0.2.3)
        actionpack (= 7.0.2.3)
        actiontext (= 7.0.2.3)
        actionview (= 7.0.2.3)
        activejob (= 7.0.2.3)
        activemodel (= 7.0.2.3)
        activerecord (= 7.0.2.3)
        activestorage (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        bundler (&gt;= 1.15.0)
        railties (= 7.0.2.3)
      rails-dom-testing (2.0.3)
        activesupport (&gt;= 4.2.0)
        nokogiri (&gt;= 1.6)
      rails-html-sanitizer (1.4.2)
        loofah (~&gt; 2.3)
      railties (7.0.2.3)
        actionpack (= 7.0.2.3)
        activesupport (= 7.0.2.3)
        method_source
        rake (&gt;= 12.2)
        thor (~&gt; 1.0)
        zeitwerk (~&gt; 2.5)
      rake (13.0.6)
      ransack (2.6.0)
        activerecord (&gt;= 6.0.4)
        activesupport (&gt;= 6.0.4)
        i18n
      regexp_parser (2.2.1)
      reline (0.3.1)
        io-console (~&gt; 0.5)
      responders (3.0.1)
        actionpack (&gt;= 5.0)
        railties (&gt;= 5.0)
      rexml (3.2.5)
      ruby2_keywords (0.0.5)
      rubyzip (2.3.2)
      scenic (1.6.0)
        activerecord (&gt;= 4.0.0)
        railties (&gt;= 4.0.0)
      scenic_sqlite_adapter (0.1.0)
        activerecord (&gt;= 4.0.0)
      selenium-webdriver (4.1.0)
        childprocess (&gt;= 0.5, &lt; 5.0)
        rexml (~&gt; 3.2, &gt;= 3.2.5)
        rubyzip (&gt;= 1.2.2)
      semantic_range (3.0.0)
      sprockets (4.0.3)
        concurrent-ruby (~&gt; 1.0)
        rack (&gt; 1, &lt; 3)
      sprockets-rails (3.4.2)
        actionpack (&gt;= 5.2)
        activesupport (&gt;= 5.2)
        sprockets (&gt;= 3.0.0)
      sqlite3 (1.4.2)
      stimulus-rails (1.0.4)
        railties (&gt;= 6.0.0)
      strscan (3.0.1)
      thor (1.2.1)
      timeout (0.2.0)
      turbo-rails (1.0.1)
        actionpack (&gt;= 6.0.0)
        railties (&gt;= 6.0.0)
      tzinfo (2.0.4)
        concurrent-ruby (~&gt; 1.0)
      tzinfo-data (1.2022.1)
        tzinfo (&gt;= 1.0.0)
      warden (1.2.9)
        rack (&gt;= 2.0.9)
      web-console (4.2.0)
        actionview (&gt;= 6.0.0)
        activemodel (&gt;= 6.0.0)
        bindex (&gt;= 0.4.0)
        railties (&gt;= 6.0.0)
      webdrivers (5.0.0)
        nokogiri (~&gt; 1.6)
        rubyzip (&gt;= 1.3.0)
        selenium-webdriver (~&gt; 4.0)
      webpacker (5.4.3)
        activesupport (&gt;= 5.2)
        rack-proxy (&gt;= 0.6.1)
        railties (&gt;= 5.2)
        semantic_range (&gt;= 2.3.0)
      websocket-driver (0.7.5)
        websocket-extensions (&gt;= 0.1.0)
      websocket-extensions (0.1.5)
      xpath (3.2.0)
        nokogiri (~&gt; 1.8)
      zeitwerk (2.5.4)
  
  PLATFORMS
    aarch64-linux
    x86_64-linux
  
  DEPENDENCIES
    activeadmin (~&gt; 2.11)
    auto_strip_attributes (~&gt; 2.6)
    bootsnap
    capybara
    debug
    devise (~&gt; 4.8)
    importmap-rails
    puma (~&gt; 5.0)
    rails (~&gt; 7.0.1)
    scenic (~&gt; 1.6)
    scenic_sqlite_adapter (~&gt; 0.1.0)
    selenium-webdriver
    sprockets-rails
    sqlite3 (~&gt; 1.4)
    stimulus-rails
    turbo-rails
    tzinfo-data
    web-console
    webdrivers
    webpacker (~&gt; 5.4)
  
  RUBY VERSION
     ruby 3.0.3p157
  
  BUNDLED WITH
     2.3.5
  </code></pre>