Bug report: Docker file generation for rails app

I got this error when running fly deploy after running fly launch:

Error: failed to fetch an image or build from source: error building: failed to solve: failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = dockerfile parse error on line 27: unknown instruction: rm (did you mean from?)

This is line 27 from the Dockerfile

# Install Node.js
    rm -rf /tmp/node-build-master

This made it run without errors

# Install Node.js
RUN rm -rf /tmp/node-build-master

So I can reproduce this, can you provide me with your Gemfile and the output of node -v?

Here is my gem file:

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

ruby "3.1.2"

gem "rails",                      "7.0.4"
gem "image_processing",           "1.12.2"
gem "active_storage_validations", "0.9.8"
gem "bcrypt",                     "3.1.18"
gem "faker",                      "2.21.0"
gem "will_paginate",              "3.3.1"
gem "bootstrap-will_paginate",    "1.0.0"
gem "bootstrap-sass",             "3.4.1"
gem "sassc-rails",                "2.1.2"
gem "sprockets-rails",            "3.4.2"
gem "importmap-rails",            "1.1.0"
gem "turbo-rails",                "1.1.1"
gem "stimulus-rails",             "1.0.4"
gem "jbuilder",                   "2.11.5"
gem "puma",                       "5.6.4"
gem "bootsnap",                   "1.12.0", require: false

group :development, :test do
  gem "sqlite3", "1.4.2"
  gem "debug",   "1.5.0", platforms: %i[ mri mingw x64_mingw ]
end

group :development do
  gem "web-console", "4.2.0"
end

group :test do
  gem "capybara",                 "3.37.1"
  gem "selenium-webdriver",       "4.2.0"
  gem "webdrivers",               "5.0.0"
  gem "rails-controller-testing", "1.0.5"
  gem "minitest",                 "5.15.0"
  gem "minitest-reporters",       "1.5.0"
  gem "guard",                    "2.18.0"
  gem "guard-minitest",           "2.4.6"
end

group :production do
  gem "pg",         "1.3.5"
  gem "aws-sdk-s3", "1.114.0", require: false
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem.
# Uncomment the following line if you're running Rails
# on a native Windows system:
# gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "dockerfile-rails", ">= 1.5", :group => :development

gem "sentry-ruby", "~> 5.11"

I’m working on a project to teach me how to use rails, so there is no javascript in my project right now.
node -v returns:
command not found: node

I’ve pushed out a fix in dockerfile-rails v1.5.6. Please try:

bundle update
bin/rails generate dockerfile

The dockerfile generated will have a number of changes (mostly deletions) as compared to the previous one. Let me know if this Dockerfile works for your application.

That worked for me thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.