简体   繁体   中英

Docker Buildx missing files in building arm 64 rails image

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.

The app is a rails app with webpacker. The missing files I've found so far are config/webpacker.yml and config/webpack/ , and app/javascript/* .

Dockerfile:

FROM ruby:3.0.3-slim-bullseye

RUN apt-get update -qq &&\
  apt install curl -y 

RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&\
  curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
  echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
  apt-get update -qq &&\
  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' &&\
  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 ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]

Docker build command:

docker buildx build --platform linux/arm64 -t my.registry.com/wedding --load .

Gemfile:

source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.0.3"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.1"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

# 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"

# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"


# Build JSON APIs with ease [https://github.com/rails/jbuilder]
# gem "jbuilder"

# gem 'activeadmin'
# gem 'devise'
# gem "auto_strip_attributes"
# gem "scenic"
# gem 'scenic_sqlite_adapter'

# gem 'webpacker'
# gem "sprockets"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# 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[ mingw mswin x64_mingw jruby ruby ]

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

# Use Sass to process CSS
# gem "sassc-rails"

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

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

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

  # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
  # gem "rack-mini-profiler"

  # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
  # gem "spring"
end

group :test do
  # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
  gem "capybara"
  gem "selenium-webdriver"
  gem "webdrivers"
end

gem "activeadmin", "~> 2.11"
gem "devise", "~> 4.8"
gem "auto_strip_attributes", "~> 2.6"
gem "scenic", "~> 1.6"
gem "scenic_sqlite_adapter", "~> 0.1.0"
gem "webpacker", "~> 5.4"

Gemfile lock:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (7.0.2.3)
      actionpack (= 7.0.2.3)
      activesupport (= 7.0.2.3)
      nio4r (~> 2.0)
      websocket-driver (>= 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 (>= 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 (~> 2.5, >= 2.5.4)
      net-imap
      net-pop
      net-smtp
      rails-dom-testing (~> 2.0)
    actionpack (7.0.2.3)
      actionview (= 7.0.2.3)
      activesupport (= 7.0.2.3)
      rack (~> 2.0, >= 2.2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 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 (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (7.0.2.3)
      activesupport (= 7.0.2.3)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activeadmin (2.11.1)
      arbre (~> 1.2, >= 1.2.1)
      formtastic (>= 3.1, < 5.0)
      formtastic_i18n (~> 0.4)
      inherited_resources (~> 1.7)
      jquery-rails (~> 4.2)
      kaminari (~> 1.0, >= 1.2.1)
      railties (>= 6.0, < 7.1)
      ransack (~> 2.1, >= 2.1.1)
    activejob (7.0.2.3)
      activesupport (= 7.0.2.3)
      globalid (>= 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 (~> 1.0)
      mini_mime (>= 1.1.0)
    activesupport (7.0.2.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    arbre (1.5.0)
      activesupport (>= 3.0.0, < 7.1)
      ruby2_keywords (>= 0.0.2, < 1.0)
    auto_strip_attributes (2.6.0)
      activerecord (>= 4.0)
    bcrypt (3.1.17)
    bindex (0.8.1)
    bootsnap (1.11.1)
      msgpack (~> 1.2)
    builder (3.2.4)
    capybara (3.36.0)
      addressable
      matrix
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (>= 1.5, < 3.0)
      xpath (~> 3.2)
    childprocess (4.1.0)
    concurrent-ruby (1.1.10)
    crass (1.0.6)
    debug (1.4.0)
      irb (>= 1.3.6)
      reline (>= 0.2.7)
    devise (4.8.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0)
      responders
      warden (~> 1.2.3)
    digest (3.1.0)
    erubi (1.10.0)
    formtastic (4.0.0)
      actionpack (>= 5.2.0)
    formtastic_i18n (0.7.0)
    globalid (1.0.0)
      activesupport (>= 5.0)
    has_scope (0.8.0)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
    i18n (1.10.0)
      concurrent-ruby (~> 1.0)
    importmap-rails (1.0.3)
      actionpack (>= 6.0.0)
      railties (>= 6.0.0)
    inherited_resources (1.13.1)
      actionpack (>= 5.2, < 7.1)
      has_scope (~> 0.6)
      railties (>= 5.2, < 7.1)
      responders (>= 2, < 4)
    io-console (0.5.11)
    io-wait (0.2.1)
    irb (1.4.1)
      reline (>= 0.3.0)
    jquery-rails (4.4.0)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    kaminari (1.2.2)
      activesupport (>= 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 (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 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 (~> 1.4)
    nokogiri (1.13.3-x86_64-linux)
      racc (~> 1.4)
    orm_adapter (0.5.0)
    public_suffix (4.0.6)
    puma (5.6.2)
      nio4r (~> 2.0)
    racc (1.6.0)
    rack (2.2.3)
    rack-proxy (0.7.2)
      rack
    rack-test (1.1.0)
      rack (>= 1.0, < 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 (>= 1.15.0)
      railties (= 7.0.2.3)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.2)
      loofah (~> 2.3)
    railties (7.0.2.3)
      actionpack (= 7.0.2.3)
      activesupport (= 7.0.2.3)
      method_source
      rake (>= 12.2)
      thor (~> 1.0)
      zeitwerk (~> 2.5)
    rake (13.0.6)
    ransack (2.6.0)
      activerecord (>= 6.0.4)
      activesupport (>= 6.0.4)
      i18n
    regexp_parser (2.2.1)
    reline (0.3.1)
      io-console (~> 0.5)
    responders (3.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    rexml (3.2.5)
    ruby2_keywords (0.0.5)
    rubyzip (2.3.2)
    scenic (1.6.0)
      activerecord (>= 4.0.0)
      railties (>= 4.0.0)
    scenic_sqlite_adapter (0.1.0)
      activerecord (>= 4.0.0)
    selenium-webdriver (4.1.0)
      childprocess (>= 0.5, < 5.0)
      rexml (~> 3.2, >= 3.2.5)
      rubyzip (>= 1.2.2)
    semantic_range (3.0.0)
    sprockets (4.0.3)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.4.2)
      actionpack (>= 5.2)
      activesupport (>= 5.2)
      sprockets (>= 3.0.0)
    sqlite3 (1.4.2)
    stimulus-rails (1.0.4)
      railties (>= 6.0.0)
    strscan (3.0.1)
    thor (1.2.1)
    timeout (0.2.0)
    turbo-rails (1.0.1)
      actionpack (>= 6.0.0)
      railties (>= 6.0.0)
    tzinfo (2.0.4)
      concurrent-ruby (~> 1.0)
    tzinfo-data (1.2022.1)
      tzinfo (>= 1.0.0)
    warden (1.2.9)
      rack (>= 2.0.9)
    web-console (4.2.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webdrivers (5.0.0)
      nokogiri (~> 1.6)
      rubyzip (>= 1.3.0)
      selenium-webdriver (~> 4.0)
    webpacker (5.4.3)
      activesupport (>= 5.2)
      rack-proxy (>= 0.6.1)
      railties (>= 5.2)
      semantic_range (>= 2.3.0)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.5.4)

PLATFORMS
  aarch64-linux
  x86_64-linux

DEPENDENCIES
  activeadmin (~> 2.11)
  auto_strip_attributes (~> 2.6)
  bootsnap
  capybara
  debug
  devise (~> 4.8)
  importmap-rails
  puma (~> 5.0)
  rails (~> 7.0.1)
  scenic (~> 1.6)
  scenic_sqlite_adapter (~> 0.1.0)
  selenium-webdriver
  sprockets-rails
  sqlite3 (~> 1.4)
  stimulus-rails
  turbo-rails
  tzinfo-data
  web-console
  webdrivers
  webpacker (~> 5.4)

RUBY VERSION
   ruby 3.0.3p157

BUNDLED WITH
   2.3.5

I found the issue, just a dumb configuration piece on my end. I had accidentally overwrote these directories with docker-compose volumes that had been cached from a previous install.

No issue here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM