lib/generators/dockerfile_generator.rb in dockerfile-rails-1.6.17 vs lib/generators/dockerfile_generator.rb in dockerfile-rails-1.6.18

- old
+ new

@@ -515,16 +515,20 @@ def using_passenger? options.passenger? or options["max-idle"] end + def includes_jobs? + !(Dir["app/jobs/*.rb"] - ["app/jobs/application_job.rb"]).empty? + end + def using_sidekiq? - @gemfile.include?("sidekiq") + @gemfile.include?("sidekiq") and includes_jobs? end def using_solidq? - @gemfile.include?("solid_queue") + @gemfile.include?("solid_queue") and includes_jobs? end def parallel? (using_node? || using_bun?) && options.parallel end @@ -1248,9 +1252,22 @@ if @gemfile.include?("shrine") more += "\n/public/uploads/*\n" end more + end + + def compose_web_volumes + volumes = %w[ log storage ] + + if deploy_database == "sqlite3" + database = YAML.load_file("config/database.yml", aliases: true).dig("production", "database") + if database && database =~ /^\w/ + volumes << File.dirname(database) + end + end + + volumes.uniq.sort end def max_idle option = options["max-idle"]