Class: Rockstart::DockerGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Rockstart::DockerGenerator
- Includes:
- Rails::Generators::AppName
- Defined in:
- lib/generators/rockstart/docker/docker_generator.rb
Instance Method Summary collapse
- #add_docker_compose ⇒ Object
- #create_certs_directory ⇒ Object
- #create_dockerfile ⇒ Object
- #create_dockerignore ⇒ Object
- #create_dotenv ⇒ Object
- #create_localhost_certificates ⇒ Object
- #create_nginx_image ⇒ Object
Instance Method Details
#add_docker_compose ⇒ Object
49 50 51 52 53 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 49 def add_docker_compose @app_home = [:app_home] template "docker-compose.yml", "docker-compose.yml" template "docker-compose.test.yml", "docker-compose.test.yml" end |
#create_certs_directory ⇒ Object
55 56 57 58 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 55 def create_certs_directory FileUtils.mkdir_p(Rails.root.join("docker", "certs", "web")) append_file ".gitignore", "\n# Docker Configuration\ndocker/certs\n" end |
#create_dockerfile ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 34 def create_dockerfile @root_image = [:root_image] @app_home = [:app_home] @postgres = [:postgres] @assets = [:assets] template "app/Dockerfile-app", "Dockerfile" end |
#create_dockerignore ⇒ Object
30 31 32 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 30 def create_dockerignore copy_file "dockerignore", ".dockerignore" end |
#create_dotenv ⇒ Object
60 61 62 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 60 def create_dotenv template "dotenv.docker.tt", ".env.docker" end |
#create_localhost_certificates ⇒ Object
64 65 66 67 68 69 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 64 def create_localhost_certificates template "localhost_domains.ext.tt", "docker/certs/web/#{app_name}_localhost.ext" template "setup-localhost.tt", "bin/setup-localhost" File.chmod(0o755, Rails.root.join("bin", "setup-localhost")) append_file ".gitignore", "\n# localhost certificate authority\nlocalhostCA.*\n" end |
#create_nginx_image ⇒ Object
42 43 44 45 46 47 |
# File 'lib/generators/rockstart/docker/docker_generator.rb', line 42 def create_nginx_image @root_image = [:root_image] @app_home = [:app_home] template "web/Dockerfile-web", "docker/web/Dockerfile" template "web/nginx.conf", "docker/web/nginx.conf" end |