Class: Modulorails::DockerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/modulorails/docker/docker_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_config_fileObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/modulorails/docker/docker_generator.rb', line 10

def create_config_file
  template 'Dockerfile'
  template 'Dockerfile.prod'
  template 'docker-compose.yml'
  template 'docker-compose.prod.yml'
  template 'entrypoints/docker-entrypoint.sh'
  chmod 'entrypoints/docker-entrypoint.sh', 0755
  template 'config/database.yml'

  # Useless unless project is using Webpacker
  if Modulorails.data.webpacker_version.present?
    template 'entrypoints/webpack-entrypoint.sh'
    chmod 'entrypoints/webpack-entrypoint.sh', 0755
  end
rescue StandardError => e
  warn("[Modulorails] Error: cannot generate Docker configuration: #{e.message}")
end