Class: Kowl::DockerGenerator

Inherits:
Generators::Base show all
Defined in:
lib/kowl/generators/docker_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root, source_paths

Methods included from Docker

#alpine_docker_dependencies, #app_js_volumes, #app_volumes, #db_volumes, #debian_database_dependencies, #debian_docker_dependencies, #docker_app_command, #docker_compose_database_string, #docker_databases, #docker_depends_on, #docker_port_watcher, #docker_redis_service, #docker_sidekiq_service, #docker_variables, #docker_volumes, #docker_webpacker_service, #dockerfile_database_args, #dockerfile_migration_snip, #js_volumes, #mysql_volumes, #postgresql_volumes, #redis_volumes

Methods included from Actions

#add_extension_routes, #add_package, #append_to_file, #database_route, #dev_config, #dup_file, #file_exists?, #mailer_gems, #mailer_route, #mk_dir, #move_file, #pry_gems, #rails_cmd, #remove_dir, #remove_file, #remove_gem, #replace_string_in_file, #robocop_test_engine, #sidekiq_route, #template_linter_gems

Instance Method Details

#setup_database_dockerfileObject

If one of the specified databases are being used, generate a specific Dockerfile to generate the required tables



34
35
36
37
38
# File 'lib/kowl/generators/docker_generator.rb', line 34

def setup_database_dockerfile
  return nil unless options[:database] == 'mysql'

  template 'mysql/Dockerfile.tt', 'docker/Dockerfile'
end

#setup_docker_composeObject

Generate an applications docker-compose.yml file based on all it’s specified requirements



29
30
31
# File 'lib/kowl/generators/docker_generator.rb', line 29

def setup_docker_compose
  template 'docker-compose.yml.tt', 'docker-compose.yml'
end

#setup_dockerfileObject

Generate the applications Dockerfile depending on the the specified distro



18
19
20
21
22
23
24
25
26
# File 'lib/kowl/generators/docker_generator.rb', line 18

def setup_dockerfile
  if options[:docker_distro] == 'debian' || options[:database] == 'oracle'
    # This is here because Debian is very compatible with most Ruby/Rails gems
    # => The Oracle InstantClient does have a number of issues when trying to build with Alpine
    template 'Dockerfile.debian.tt', 'Dockerfile'
  else
    template 'Dockerfile.alpine.tt', 'Dockerfile'
  end
end