dockerize-stack 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 463c73cd30ce0f03ffbdeeffa99db4a7eedda9ac3611bd5c9e7ac8d477cc3d97
4
- data.tar.gz: 7ec780a8f81ba600fc3e29a10456c8412c0cdaf8784dd99cb6476c3f86a7db5c
3
+ metadata.gz: b499b28348c817d3cb4684f8579183faf30a7b8262b95cb98c1b9a9535ecb3ee
4
+ data.tar.gz: 53f0fd0799c0db54c79844fe01c27f48b4b8e1ebd6a8058dd65fbaa9bbaa942a
5
5
  SHA512:
6
- metadata.gz: 5927bd9855ff172132ae13ded16c2b0a77ab46f7d8e5b81cee01fc0e81ca558ad2685ff6691e1b11246b4db8f4d6934bd2113384dd20b7d5137f80c9466489c1
7
- data.tar.gz: 7572551ff734743ba341b0b0ea7408018571bacaf502b7e92c2cb341130535e8c58bb36623b446a15c24efd1d8c67103307a657135e3a6f7b75c1628979ff5e7
6
+ metadata.gz: '008333cf81fc7cd01a5b870ff29cea94ed9b3fe5cffd049861896f5fa435ebdf9e5622b0f9907bbf69b54e2ee721bf91db153c9f5b389e505355e0ddce0da93f'
7
+ data.tar.gz: fab9fbc02cd471508f0e0b00f7d1a890b2d4fcfba872299def2ffa1eec041f1cd847eed800c6a93a4f3b1c9bbd63afaeba9131d6c824a3143b7da68803fab871
data/README.md CHANGED
@@ -1,16 +1,12 @@
1
1
  # Dockerize Stack
2
2
 
3
- This it's a generator for generate Dockerfile and docker-compose for your application for development and production
3
+ This it's a generator for generate Dockerfile and docker-compose for your application
4
4
 
5
5
  ## Why?
6
6
 
7
7
  - Help to configure multiple applications using the same templates.
8
8
 
9
- - For build a quick stack for your development enviroment docker is the best tool you can use, but you need to configure the Dockerfile docker-compose, persisted database data, set the entrypoint...
10
-
11
- - For deploy to kubernetes you need first Dockerfile for your application, this templates help to build optimize docker image for productions enviroments.
12
-
13
- - Using templates is more easy customize docker build process (Dockerfile, docker-compose).
9
+ - Using templates is more easy to dockerize diferent type of projects.
14
10
 
15
11
  ## Install
16
12
 
@@ -40,22 +36,20 @@ docker run --user $(id -u) -it -v $(pwd):/usr/src devmasx/dockerize-stack rails
40
36
 
41
37
  [rails example](./examples/rails)
42
38
 
43
- By default the Dockerfile config is for production enviroment; using docker multistage feature and ARG (Build arguments) at the build time this Dockerfile is the same for development and production.
44
-
45
39
  See all options:
46
40
 
47
41
  ```
48
- dockerize-stack help rails
49
- ```
50
-
51
- Build a docker image for development enviroment:
52
-
53
- ```
54
- docker build -t rails-example \
55
- --build-arg=BUNDLE_DEPLOYMENT="false" \
56
- --build-arg=BUNDLE_WITHOUT="" \
57
- --build-arg=NODE_ENV="" \
58
- .
42
+ Options:
43
+ t, [--template-folder=TEMPLATE_FOLDER] # Template folder path
44
+ o, [--output-folder=OUTPUT_FOLDER] # Output folder
45
+ # Default: .
46
+ [--ruby-version=RUBY_VERSION] # Ruby Version (default 2.5.6):
47
+ [--nodejs-version=NODEJS_VERSION] # Nodejs version (default 10.16.3):
48
+ [--javascrit-package-manager=JAVASCRIT_PACKAGE_MANAGER] # What is your Javascript package manager?
49
+ [--database=DATABASE] # What is your Database?
50
+ [--rails-worker=RAILS_WORKER] # You need workers with sidekiq? y/n, (default y)
51
+ [--github-private=GITHUB_PRIVATE] # You need github token for private gems? y/n (default no)
52
+ [--kubernetes=KUBERNETES] # You want generate docker-stack for kubernetes? y/n (default no)
59
53
  ```
60
54
 
61
55
  ## TODO
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pry'
5
+ require_relative '../lib/dockerize_stack'
6
+
7
+ Pry.start
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require_relative '../lib/dockerize_stack'
3
5
  DockerizeStack::Command.start(ARGV)
@@ -1,28 +1,56 @@
1
1
  rails:
2
- defaults:
3
- ruby_version: "2.5.6"
4
- nodejs_version: "10.16.3"
5
- yarn_version: "1.17.3"
6
- javascrit_package_manager:
7
- - asset_pipeline
8
- - yarn
9
- - npm
10
- database:
11
- - postgresql
12
- - mysql
13
- rails_worker: true
14
- github_private: false
15
- kubernetes: false
16
2
  questions:
17
- ruby_version: "Ruby Version (default 2.5.6):"
18
- javascrit_package_manager: What is your Javascript package manager?
19
- database: What is your Database?
20
- rails_worker: You need workers with sidekiq? y/n, (default y)
21
- github_private: You need github token for private gems? y/n (default no)
22
- kubernetes: You want generate docker-stack for kubernetes? y/n (default no)'
3
+ - option: ruby_version
4
+ title: "Ruby Version (default 2.5.6):"
5
+ description: Ruby version
6
+ default: "2.5.6"
7
+ type: ask_with_default
8
+
9
+ - option: nodejs_version
10
+ title: "Nodejs version (default 10.16.3):"
11
+ default: "10.16.3"
12
+ type: with_default
13
+
14
+ - option: javascrit_package_manager
15
+ title: What is your Javascript package manager?
16
+ description: Select the package manager for Javascript modules
17
+ default: "yarn"
18
+ type: ask_with_options
19
+ ask_options:
20
+ - asset_pipeline
21
+ - yarn
22
+ - npm
23
+
24
+ - option: database
25
+ title: What is your Database?
26
+ description: Database type
27
+ default: "postgresql"
28
+ type: ask_with_options
29
+ ask_options:
30
+ - postgresql
31
+ - mysql
32
+
33
+ - option: rails_worker
34
+ title: You need workers with sidekiq? y/n, (default y)
35
+ description: Rails sidekiq examples in docker-compose.yml
36
+ default: "y"
37
+ type: ask_with_default_boolean
38
+
39
+ - option: github_private
40
+ title: You need github token for private gems? y/n (default no)
41
+ description: Set GITHUB_USERNAME and GITHUB_TOKEN in dockerfile bundle config
42
+ default: "y"
43
+ type: ask_with_default_boolean
44
+
45
+ - option: kubernetes
46
+ title: You want generate docker-stack for kubernetes? y/n (default no)
47
+ description: Basic examples for kubernetes config (minikube)
48
+ default: "n"
49
+ type: ask_with_default_boolean
23
50
 
24
51
  react:
25
- defaults:
26
- nodejs_version: "10.16.3"
27
52
  questions:
28
- nodejs_version: "Nodejs version (default 10.16.3):"
53
+ - option: nodejs_version
54
+ title: "Nodejs version (default 10.16.3):"
55
+ default: "10.16.3"
56
+ type: ask_with_default
@@ -1,13 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
  require_relative './thor_extend.rb'
3
- require_relative './dockerize_stack/react.rb'
4
- require_relative './dockerize_stack/rails.rb'
5
5
 
6
6
  module DockerizeStack
7
7
  class Command < Thor
8
8
  include Thor::Actions
9
9
  include ThorActionsExtend
10
- RAILS_CONFIG_DEFAULTS = CONFIG.dig(:rails, :defaults)
11
10
 
12
11
  option :template_folder,
13
12
  aliases: 't',
@@ -16,38 +15,26 @@ module DockerizeStack
16
15
  default: '.',
17
16
  aliases: 'o',
18
17
  desc: 'Output folder'
19
- option :ruby_version,
20
- banner: RAILS_CONFIG_DEFAULTS[:ruby_version],
21
- desc: 'Ruby version'
22
- option :javascrit_package_manager,
23
- banner: 'npm',
24
- enum: RAILS_CONFIG_DEFAULTS[:javascrit_package_manager]
25
- option :nodejs_version,
26
- banner: RAILS_CONFIG_DEFAULTS[:nodejs_version],
27
- desc: 'Nodejs version'
28
- option :yarn_version,
29
- banner: RAILS_CONFIG_DEFAULTS[:yarn_version],
30
- desc: 'Yarn version'
31
- option :database,
32
- banner: 'postgresql',
33
- enum: RAILS_CONFIG_DEFAULTS[:database],
34
- desc: 'Database type'
35
- option :rails_worker,
36
- type: :boolean,
37
- banner: RAILS_CONFIG_DEFAULTS[:rails_worker],
38
- desc: 'Rails sidekiq examples in docker-compose.yml'
39
- option :github_private,
40
- type: :boolean,
41
- banner: RAILS_CONFIG_DEFAULTS[:github_private],
42
- desc: 'Set GITHUB_USERNAME and GITHUB_TOKEN in dockerfile bundle config'
43
- option :kubernetes,
44
- type: :boolean,
45
- banner: RAILS_CONFIG_DEFAULTS[:kubernetes],
46
- desc: 'Basic examples for kubernetes config (minikube)'
18
+
19
+ CONFIG[:rails][:questions].each do |question|
20
+ option question[:option],
21
+ desc: question[:title]
22
+ end
47
23
 
48
24
  desc 'rails', 'generate docker files for rails application'
49
25
  def rails
50
- DockerizeStack::Rails.new.run(options)
26
+ run(options, :rails)
27
+ all_file_paths(:rails).each do |file_path|
28
+ if file_path =~ %r{./templates/rails/kubernetes} && !@kubernetes
29
+ return false
30
+ end
31
+
32
+ file_name = file_path.gsub('/templates/rails', '')
33
+ template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
34
+ end
35
+ render_template! '.dockerignore.erb'
36
+
37
+ puts 'Update your database.yml based in database-docker.yml'
51
38
  end
52
39
 
53
40
  option :template_folder, aliases: 't', desc: 'Template folder path'
@@ -56,7 +43,12 @@ module DockerizeStack
56
43
 
57
44
  desc 'react', 'generate docker files for create react app'
58
45
  def react
59
- DockerizeStack::React.new.run(options)
46
+ run(options, :react)
47
+ all_file_paths(:react).each do |file_path|
48
+ file_name = file_path.gsub('/templates/react', '')
49
+ template file_name, "#{@output_folder}/#{file_name.gsub('.erb', '')}"
50
+ end
51
+ render_template! '.dockerignore.erb'
60
52
  end
61
53
  end
62
54
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'json'
3
5
 
@@ -5,59 +7,67 @@ module ThorActionsExtend
5
7
  include Thor::Actions
6
8
 
7
9
  CONFIG = JSON.parse(
8
- JSON.dump(YAML.load_file("#{File.dirname(__FILE__)}/config.yml")),
9
- symbolize_names: true
10
- )
11
- def run(options)
10
+ JSON.dump(YAML.load_file("#{File.dirname(__FILE__)}/config.yml")),
11
+ symbolize_names: true
12
+ )
13
+
14
+ def run(options, template_type)
12
15
  @template_type = template_type
13
16
  @options = options
17
+ @output_folder = options['output_folder']
14
18
  @config = CONFIG[@template_type]
15
- self.class.source_root(template_folder(@template_type.to_s))
19
+ self.class.source_root(template_folder)
16
20
 
17
21
  fetch_template_variables
18
- render_templates
19
- end
20
-
21
- private
22
-
23
- def template_folder(template_type)
24
- @options[:template_folder] || "#{File.dirname(__FILE__)}/../templates/#{template_type}"
25
- end
26
-
27
- def render_template(path, target_path = path)
28
- template path, "#{@output_folder}/#{target_path.gsub('.erb', '')}"
29
22
  end
30
23
 
31
- def with_default(option)
32
- return @config[:defaults][option] if @options[option].nil?
33
-
34
- @options[option]
24
+ def fetch_template_variables
25
+ @config[:questions].each do |question|
26
+ default = question[:default]
27
+ option = question[:option]
28
+ title = question[:title]
29
+ type = question[:type]
30
+
31
+ if @options[option] || @options[option] == false
32
+ instance_variable_set("@#{option}", @options[option])
33
+ next
34
+ end
35
+
36
+ case type
37
+ when 'with_default'
38
+ instance_variable_set("@#{option}", default)
39
+ when 'ask_with_default'
40
+ result = ask(title)
41
+ result == '' ? default : result
42
+
43
+ instance_variable_set("@#{option}", result)
44
+ when 'ask_with_default_boolean'
45
+ result = ask(title)
46
+ result = default if result == ''
47
+ result = %w[yes y true].include?(result) ? true : false
48
+
49
+ instance_variable_set("@#{option}", result)
50
+ when 'ask_with_options'
51
+ instance_variable_set("@#{option}", ask(title, limited_to: question[:ask_options]))
52
+ else
53
+ raise "Invalid question type: #{type}"
54
+ end
55
+ end
35
56
  end
36
57
 
37
- def ask_with_default(option, default = nil)
38
- return @options[option] unless @options[option].nil?
39
-
40
- default = @config[:defaults][option] if default.nil?
41
- result = ask(@config[:questions][option])
58
+ private
42
59
 
43
- result == '' ? default : result
60
+ def render_template!(template_file)
61
+ result = ERB.new(File.read("#{template_folder}/#{template_file}")).result(binding)
62
+ File.write("#{@output_folder}/#{template_file.gsub('.erb', '')}", result)
44
63
  end
45
64
 
46
- def ask_with_options(option, limited_to = nil)
47
- return @options[option] if @options[option]
48
-
49
- limited_to = @config[:defaults][option] if limited_to.nil?
50
- ask(@config[:questions][option], limited_to: limited_to)
65
+ def all_file_paths(type)
66
+ Dir.glob("./templates/#{type}/**/*").reject { |x| File.directory?(x) }
51
67
  end
52
68
 
53
- def ask_with_default_boolean(option)
54
- return @options[option] unless @options[option].nil?
55
-
56
- result = ask(@config[:questions][option])
57
- default = @config[:defaults][option] if default.nil?
58
- return default if result == ''
59
-
60
- %w[yes y true].include?(result) ? true : false
69
+ def template_folder
70
+ @options[:template_folder] || "#{File.dirname(__FILE__)}/../templates/#{@template_type}"
61
71
  end
62
72
 
63
73
  def append_or_create(file_path, file_content)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DockerizeStack
2
- VERSION = '0.6.0'
4
+ VERSION = '0.7.0'
3
5
  end
@@ -1,30 +1,30 @@
1
1
  # ****************************
2
2
  # ******Build base stage******
3
3
  # ****************************
4
- <% if javascrit_package_manager != "asset_pipeline" %>
5
- FROM node:<%= nodejs_version %>-slim as nodejs
4
+ <% if @javascrit_package_manager != "asset_pipeline" %>
5
+ FROM node:<%= @nodejs_version %>-slim as nodejs
6
6
  <% end %>
7
- FROM ruby:<%= ruby_version %>-slim as builder
7
+ FROM ruby:<%= @ruby_version %>-slim as builder
8
8
 
9
9
  # Install common libs
10
10
  RUN apt-get update -qq && apt-get install -y \
11
11
  build-essential vim git
12
- <% if database == "mysql" %>
12
+ <% if @database == "mysql" %>
13
13
  # Install Mysql
14
14
  RUN apt-get install -y mysql-client libmysqlclient-dev
15
- <% elsif database == "postgresql" %>
15
+ <% elsif @database == "postgresql" %>
16
16
  # Install Postgresql
17
17
  RUN apt-get install -y postgresql-client libpq-dev
18
18
  <% end %>
19
- # Install Nodejs<% if javascrit_package_manager == "asset_pipeline" %>
19
+ # Install Nodejs<% if @javascrit_package_manager == "asset_pipeline" %>
20
20
  RUN apt-get install -y nodejs npm
21
- <% elsif javascrit_package_manager == "yarn" %>
22
- ENV NODE_VERSION=<%= nodejs_version %> YARN_VERSION=<%= yarn_version %>
21
+ <% elsif @javascrit_package_manager == "yarn" %>
22
+ ENV NODE_VERSION=<%= @nodejs_version %> YARN_VERSION=<%= @yarn_version %>
23
23
  COPY --from=nodejs /usr/local/bin/ /usr/local/bin/
24
24
  COPY --from=nodejs /usr/local/lib/ /usr/local/lib/
25
- COPY --from=nodejs /opt/yarn-v<%= yarn_version %>/ /opt/yarn-v<%= yarn_version %>/
26
- <% elsif javascrit_package_manager == "npm" %>
27
- ENV NODE_VERSION=<%= nodejs_version %>
25
+ COPY --from=nodejs /opt/yarn-v<%= @yarn_version %>/ /opt/yarn-v<%= @yarn_version %>/
26
+ <% elsif @javascrit_package_manager == "npm" %>
27
+ ENV NODE_VERSION=<%= @nodejs_version %>
28
28
  COPY --from=nodejs /usr/local/bin/ /usr/local/bin/
29
29
  COPY --from=nodejs /usr/local/lib/ /usr/local/lib/
30
30
  <% end %>
@@ -46,15 +46,15 @@ ENV NODE_ENV=$NODE_ENV
46
46
  # Gems cache layer
47
47
  COPY Gemfile Gemfile.lock /app/
48
48
  RUN bundle install -j 4
49
- <% if javascrit_package_manager == "yarn" %>
49
+ <% if @javascrit_package_manager == "yarn" %>
50
50
  # Node modules cache layer
51
51
  COPY package.json yarn.lock /app/
52
52
  RUN yarn install --pure-lockfile
53
- <% elsif javascrit_package_manager == "npm" %>
53
+ <% elsif @javascrit_package_manager == "npm" %>
54
54
  # Node modules cache layer
55
55
  COPY package.json package-lock.json /app/
56
56
  RUN npm ci
57
- <% elsif javascrit_package_manager == "asset_pipeline" %>
57
+ <% elsif @javascrit_package_manager == "asset_pipeline" %>
58
58
  <% end %>
59
59
  COPY . .
60
60
  CMD "./entrypoint.sh"
@@ -64,24 +64,25 @@ CMD "./entrypoint.sh"
64
64
  # ****************************
65
65
 
66
66
  FROM builder as production-builder
67
+ ENV NODE_ENV=production RAILS_ENV=production
67
68
 
68
69
  # Build production assets
69
70
  RUN bundle exec rails assets:precompile
70
- <% if javascrit_package_manager != "asset_pipeline" %>
71
+ <% if @javascrit_package_manager != "asset_pipeline" %>
71
72
  RUN rm -r node_modules
72
73
  <% end %>
73
74
  # **********************************
74
75
  # ******Final production Stage******
75
76
  # **********************************
76
77
 
77
- FROM ruby:<%= ruby_version %>-slim
78
+ FROM ruby:<%= @ruby_version %>-slim
78
79
 
79
80
  ENV NODE_ENV=production RAILS_ENV=production RAILS_LOG_TO_STDOUT=true
80
81
 
81
82
  # Install system dependencies
82
- <% if javascrit_package_manager != "asset_pipeline" %>
83
+ <% if @javascrit_package_manager != "asset_pipeline" %>
83
84
  COPY --from=nodejs /usr/local/ /usr/local/
84
- <% end %><% if javascrit_package_manager == "asset_pipeline" %>
85
+ <% end %><% if @javascrit_package_manager == "asset_pipeline" %>
85
86
  RUN apt-get update -qq && apt-get install -y \
86
87
  libpq-dev \
87
88
  nodejs \
@@ -1,6 +1,6 @@
1
1
  # Update your database.yml based in database-docker.yml
2
2
 
3
- <% if database == "postgresql" %>
3
+ <% if @database == "postgresql" %>
4
4
  # Install the pg driver:
5
5
  # gem install pg
6
6
 
@@ -14,7 +14,7 @@ default: &default
14
14
  password: <%%= ENV.fetch("DATABASE_PASSWORD") { "" } %>
15
15
  pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
16
 
17
- <% elsif database == "mysql" %>
17
+ <% elsif @database == "mysql" %>
18
18
  # Install the MySQL driver
19
19
  # gem install mysql2
20
20
 
@@ -1,7 +1,7 @@
1
1
  bundle check || bundle install
2
2
  rake db:create db:migrate
3
3
  rm -f tmp/pids/server.pid
4
- <% if javascrit_package_manager == "asset_pipeline" %>
4
+ <% if @javascrit_package_manager == "asset_pipeline" %>
5
5
  rm -rf public/packs/* || true && bin/webpack-dev-server &
6
6
  <% end %>
7
7
  bundle exec rails server -p 3000 -b 0.0.0.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerize-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Savignano
@@ -33,17 +33,15 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - LICENSE
35
35
  - README.md
36
+ - bin/console
36
37
  - bin/dockerize-stack
37
38
  - lib/config.yml
38
39
  - lib/dockerize_stack.rb
39
- - lib/dockerize_stack/rails.rb
40
- - lib/dockerize_stack/react.rb
41
40
  - lib/thor_extend.rb
42
41
  - lib/version.rb
43
42
  - templates/rails/Dockerfile.erb
44
43
  - templates/rails/config/database-docker.yml.erb
45
44
  - templates/rails/docker-compose.yml.erb
46
- - templates/rails/dockerignore.erb
47
45
  - templates/rails/entrypoint.sh.erb
48
46
  - templates/rails/kubernetes/scripts/deploy.sh
49
47
  - templates/rails/kubernetes/scripts/get-secrets.sh
@@ -61,7 +59,6 @@ files:
61
59
  - templates/rails/nginx/etc/nginx/conf.d/default.conf
62
60
  - templates/rails/nginx/etc/nginx/nginx.conf
63
61
  - templates/react/Dockerfile.erb
64
- - templates/react/dockerignore.erb
65
62
  - templates/react/nginx/conf.d/default.conf.template
66
63
  homepage: https://github.com/MiguelSavignano/dockerize-stack
67
64
  licenses:
@@ -1,48 +0,0 @@
1
- module DockerizeStack
2
- # Ask variables and render templates
3
- class Rails < Thor
4
- include Thor::Actions
5
- include ThorActionsExtend
6
-
7
- attr_accessor :ruby_version, :javascrit_package_manager, :nodejs_version,
8
- :yarn_version, :database, :github_private, :kubernetes, :output_folder
9
-
10
- no_commands do
11
- def template_type
12
- :rails
13
- end
14
-
15
- def run(options)
16
- super(options)
17
- render_kubernetes_templates if @kubernetes
18
- end
19
-
20
- def fetch_template_variables
21
- @output_folder = with_default(:output_folder)
22
- @nodejs_version = with_default(:nodejs_version)
23
- @yarn_version = with_default(:yarn_version)
24
-
25
- @ruby_version = ask_with_default(:ruby_version)
26
- @javascrit_package_manager = ask_with_options(:javascrit_package_manager)
27
- @database = ask_with_options(:database)
28
- @rails_worker = ask_with_default_boolean(:rails_worker)
29
- @github_private = ask_with_default_boolean(:github_private)
30
- @kubernetes = ask_with_default_boolean(:kubernetes)
31
- end
32
-
33
- def render_templates
34
- render_template 'Dockerfile.erb'
35
- render_template 'entrypoint.sh.erb'
36
- render_template 'docker-compose.yml.erb'
37
- render_template 'config/database-docker.yml.erb'
38
- render_template 'dockerignore.erb', '.dockerignore'
39
-
40
- puts 'Update your database.yml based in database-docker.yml'
41
- end
42
-
43
- def render_kubernetes_templates
44
- directory 'kubernetes', "#{@output_folder}/kubernetes"
45
- end
46
- end
47
- end
48
- end
@@ -1,29 +0,0 @@
1
- require 'thor'
2
- # Ask variables and render templates
3
- module DockerizeStack
4
- # Ask variables and render templates
5
- class React < Thor
6
- include Thor::Actions
7
- include ThorActionsExtend
8
-
9
- attr_accessor :nodejs_version, :output_folder
10
-
11
- no_commands do
12
- def template_type
13
- :react
14
- end
15
-
16
- def fetch_template_variables
17
- @output_folder = with_default(:output_folder)
18
- @nodejs_version = ask_with_default(:nodejs_version)
19
- end
20
-
21
- def render_templates
22
- render_template 'Dockerfile.erb'
23
- render_template 'dockerignore.erb', '.dockerignore'
24
-
25
- directory 'nginx', "#{@output_folder}/nginx"
26
- end
27
- end
28
- end
29
- end
@@ -1,20 +0,0 @@
1
- # Ignore all files from .gitignore
2
- # echo .git > .dockerignore && cat .gitignore >> .dockerignore
3
-
4
- /log/*
5
- /tmp/*
6
-
7
- .byebug_history
8
-
9
- volumes
10
-
11
-
12
- public/packs
13
- public/packs-test
14
- public/uploads
15
-
16
- node_modules
17
- coverage
18
- yarn-error.log
19
- .DS_Store
20
- .git
@@ -1,27 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
- # echo .git > .dockerignore && cat .gitignore >> .dockerignore
3
-
4
- .git
5
- Dockerfile
6
-
7
- # dependencies
8
- /node_modules
9
- /.pnp
10
- .pnp.js
11
-
12
- # testing
13
- /coverage
14
-
15
- # production
16
- /build
17
-
18
- # misc
19
- .DS_Store
20
- .env.local
21
- .env.development.local
22
- .env.test.local
23
- .env.production.local
24
-
25
- npm-debug.log*
26
- yarn-debug.log*
27
- yarn-error.log*