roro 0.3.6 → 0.3.13

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.
Files changed (72) hide show
  1. checksums.yaml +5 -5
  2. data/{lib/roro/cli/templates/dockerize/.env → .circleci}/.keep +0 -0
  3. data/.circleci/config.yml +55 -0
  4. data/{lib/roro/cli/templates/ruby_gem → .circleci}/setup-gem-credentials.sh +1 -1
  5. data/.gitignore +13 -3
  6. data/Guardfile +2 -12
  7. data/docker-compose.yml +15 -0
  8. data/lib/roro.rb +0 -1
  9. data/lib/roro/cli.rb +70 -4
  10. data/lib/roro/cli/cli.rb +99 -0
  11. data/lib/roro/cli/configuration.rb +1 -0
  12. data/lib/roro/cli/expose.rb +8 -7
  13. data/lib/roro/cli/generate/config.rb +5 -5
  14. data/lib/roro/cli/generate/generate_keys.rb +47 -79
  15. data/lib/roro/cli/greenfield.rb +11 -21
  16. data/lib/roro/cli/obfuscate.rb +10 -11
  17. data/lib/roro/cli/rollon.rb +2 -2
  18. data/lib/roro/cli/rollon/stories.rb +2 -3
  19. data/lib/roro/cli/{templates/dockerize/.env/development/.keep → rollon/stories/database.rb} +0 -0
  20. data/lib/roro/cli/rollon/stories/rails.rb +1 -0
  21. data/lib/roro/cli/{templates/dockerize → rollon/stories/rails}/.keep +0 -0
  22. data/lib/roro/cli/rollon/{database → stories/rails}/database.rb +2 -0
  23. data/lib/roro/cli/rollon/{database → stories/rails/database}/with_mysql.rb +0 -0
  24. data/lib/roro/cli/rollon/{database/with_postgres.rb → stories/rails/database/with_postgresql.rb} +0 -0
  25. data/lib/roro/cli/rollon/stories/ruby_gem.rb +77 -0
  26. data/lib/roro/cli/rollon/stories/ruby_gem/with_ci_cd.rb +45 -0
  27. data/lib/roro/cli/rollon/stories/stories.rb +3 -0
  28. data/lib/roro/cli/ruby_gem.rb +60 -47
  29. data/lib/roro/cli/templates/base/.dockerignore +2 -2
  30. data/lib/roro/cli/templates/base/.env/database.mysql.env.tt +0 -1
  31. data/lib/roro/cli/templates/base/.env/database.pg.env.tt +0 -1
  32. data/lib/roro/cli/templates/base/.env/web.env.tt +1 -0
  33. data/lib/roro/cli/templates/base/Dockerfile.tt +53 -15
  34. data/lib/roro/cli/templates/greenfield/Dockerfile.tt +1 -1
  35. data/lib/roro/cli/templates/ruby_gem/{docker/env_files → .circleci}/.keep +0 -0
  36. data/lib/roro/cli/templates/ruby_gem/.circleci/config.yml.tt +40 -0
  37. data/lib/roro/cli/templates/ruby_gem/.circleci/setup-gem-credentials.sh +3 -0
  38. data/lib/roro/cli/templates/ruby_gem/docker-compose.yml +10 -4
  39. data/lib/roro/cli/templates/ruby_gem/{docker/keys → roro/containers}/.keep +0 -0
  40. data/lib/roro/cli/templates/ruby_gem/roro/containers/ruby_image/Dockerfile.tt +16 -0
  41. data/lib/roro/cli/templates/ruby_gem/roro/containers/ruby_image/ci.env.tt +1 -0
  42. data/lib/roro/cli/templates/ruby_gem/roro/keys/.keep +0 -0
  43. data/lib/roro/cli/templates/stories/rails/database/with_mysql/_service.yml +10 -0
  44. data/lib/roro/cli/templates/stories/rails/database/with_postgresql/.keep +0 -0
  45. data/lib/roro/cli/templates/stories/rails/database/with_postgresql/_service.yml +7 -0
  46. data/lib/roro/cli/templates/stories/ruby_gem/with_ci_cd/_build.yml +11 -0
  47. data/lib/roro/version.rb +1 -1
  48. data/roro.gemspec +3 -3
  49. data/roro/containers/.keep +0 -0
  50. data/roro/containers/ruby_image/Dockerfile +16 -0
  51. data/roro/containers/ruby_image/ci.env.enc +2 -0
  52. data/roro/keys/.keep +0 -0
  53. data/sandbox/.keep +0 -0
  54. data/tmp/.keep +0 -0
  55. data/vendor/cache/concurrent-ruby-1.1.7.gem +0 -0
  56. data/vendor/cache/gem-release-2.1.1.gem +0 -0
  57. metadata +59 -35
  58. data/lib/roro/cli/generate_keys.rb +0 -79
  59. data/lib/roro/cli/templates/circleci/config.yml.tt +0 -70
  60. data/lib/roro/cli/templates/dockerize/.env/development/database +0 -3
  61. data/lib/roro/cli/templates/dockerize/.env/development/web +0 -1
  62. data/lib/roro/cli/templates/dockerize/Dockerfile.tt +0 -23
  63. data/lib/roro/cli/templates/dockerize/docker-compose.yml.tt +0 -60
  64. data/lib/roro/cli/templates/dockerize/docker-entrypoint.sh +0 -9
  65. data/lib/roro/cli/templates/quickstart/Dockerfile.tt +0 -20
  66. data/lib/roro/cli/templates/quickstart/database.yml +0 -85
  67. data/lib/roro/cli/templates/quickstart/docker-compose.yml +0 -17
  68. data/lib/roro/cli/templates/quickstart/entrypoint.sh +0 -8
  69. data/lib/roro/cli/templates/ruby_gem/.gitignore +0 -8
  70. data/lib/roro/cli/templates/ruby_gem/config.yml +0 -122
  71. data/lib/roro/cli/templates/ruby_gem/docker/containers/app/Dockerfile.tt +0 -10
  72. data/vendor/cache/concurrent-ruby-1.1.6.gem +0 -0
@@ -1,28 +1,17 @@
1
- require 'os'
2
-
3
1
  module Roro
4
2
 
5
3
  class CLI < Thor
6
-
7
- include Thor::Actions
8
-
9
- desc "greenfield", "Greenfield a brand new rails app using Docker's instructions"
10
-
11
- method_option :env_vars, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "key1:value1 key2:value2"
12
- method_option :interactive, desc: "Set up your environment variables as you go."
13
- method_option :force, desc: "force over-write of existing files"
14
-
15
-
16
- def greenfield
17
- confirm_directory_empty
18
- confirm_dependencies
19
- remove_roro_artifacts
20
- configure_for_greenfielding
21
- copy_greenfield_files
22
- run_greenfield_commands
23
- end
24
-
4
+
25
5
  no_commands do
6
+
7
+ def greenfield
8
+ confirm_directory_empty
9
+ confirm_dependencies
10
+ remove_roro_artifacts
11
+ configure_for_greenfielding
12
+ copy_greenfield_files
13
+ run_greenfield_commands
14
+ end
26
15
 
27
16
  def configure_for_greenfielding
28
17
  @config ||= Roro::Configuration.new(options)
@@ -35,6 +24,7 @@ module Roro
35
24
 
36
25
  def copy_greenfield_files
37
26
  template 'greenfield/Dockerfile.tt', 'Dockerfile', @config.app
27
+ template 'roro/docker-compose.yml.tt', 'docker-compose.yml', @config.app
38
28
  end
39
29
  end
40
30
  end
@@ -3,17 +3,16 @@ require 'handsome_fencer/crypto'
3
3
  module Roro
4
4
 
5
5
  class CLI < Thor
6
-
7
- include Thor::Actions
8
- include HandsomeFencer::Crypto
9
-
10
- desc "obfuscate", "obfuscates any files matching the pattern ./docker/**/*.env"
11
-
12
- def obfuscate(*args)
13
- default_environments = %w[circleci development staging production]
14
- environments = args.first ? [args.first] : default_environments
15
- environments.each do |environment|
16
- HandsomeFencer::Crypto.obfuscate(environment, 'docker')
6
+
7
+ no_commands do
8
+ include Thor::Actions
9
+ include HandsomeFencer::Crypto
10
+
11
+ def obfuscate(*args)
12
+ environments = args.first ? [args.first] : gather_environments
13
+ environments.each do |environment|
14
+ HandsomeFencer::Crypto.obfuscate(environment, 'roro')
15
+ end
17
16
  end
18
17
  end
19
18
  end
@@ -1,4 +1,4 @@
1
- require_relative 'rollon/stories'
1
+ require 'roro/cli/rollon/stories'
2
2
 
3
3
  module Roro
4
4
 
@@ -17,7 +17,7 @@ module Roro
17
17
  configure_for_rollon
18
18
 
19
19
  copy_roro_files
20
- generate_roro_config
20
+ generate_config
21
21
  startup_commands
22
22
  end
23
23
 
@@ -1,3 +1,2 @@
1
- require_relative 'database/with_postgres.rb'
2
- require_relative 'database/with_mysql.rb'
3
- require_relative 'database/database.rb'
1
+ require 'roro/cli/rollon/stories/ruby_gem'
2
+ require 'roro/cli/rollon/stories/rails'
@@ -0,0 +1 @@
1
+ require 'roro/cli/rollon/stories/rails/database'
@@ -1,3 +1,5 @@
1
+ require 'roro/cli/rollon/stories/rails/database/with_mysql'
2
+ require 'roro/cli/rollon/stories/rails/database/with_postgresql'
1
3
  module Roro
2
4
 
3
5
  class CLI < Thor
@@ -0,0 +1,77 @@
1
+ require 'roro/cli/rollon/stories/ruby_gem/with_ci_cd.rb'
2
+ # class RubyGem
3
+ # attr_reader :getsome
4
+
5
+ # def initialize
6
+ # @getsome = 'getsome'
7
+ # end
8
+ # end
9
+
10
+ # include Stories::RubyGem
11
+ # module Rollon
12
+ # module Story
13
+
14
+ # end
15
+ # end
16
+ # class Rollon::Story::RubyGem < Roro::CLI
17
+ # attr_reader :getsome
18
+ # def initialize
19
+ # @getsome = 'getsome'
20
+ # end
21
+ # end
22
+
23
+ # # module Roro
24
+
25
+ # # class CLI < Thor
26
+
27
+
28
+ # # no_commands do
29
+
30
+ # # def ruby_gem(*args)
31
+
32
+
33
+ # # end
34
+ # # def copy_ruby_gem_files
35
+ # # copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
36
+ # # end
37
+ # # end
38
+
39
+ # # def ruby_gem
40
+ # # rubies = options["rubies"] || ["2.5.3", "2.6.0"]
41
+ # # copy_file 'ruby_gem/docker-compose.yml', 'docker-compose.yml'
42
+ # # copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
43
+ # # copy_file 'ruby_gem/setup-gem-credentials.sh', '.circleci/setup-gem-credentials.sh'
44
+ # # directory 'ruby_gem/docker', 'docker', { ruby_version: "2.5"}
45
+
46
+ # # rubies.each do |ruby|
47
+ # # rubydash = ruby.gsub('.', '-')
48
+ # # rubyunderscore = ruby.gsub('.', '_')
49
+ # # doc_loc = "docker/containers/#{rubyunderscore}/Dockerfile"
50
+ # # content = <<-EOM
51
+
52
+ # # app-#{rubydash}:
53
+ # # build:
54
+ # # context: .
55
+ # # dockerfile: #{doc_loc}
56
+ # # command: rake test
57
+ # # EOM
58
+ # # append_to_file 'docker-compose.yml', content
59
+ # # template 'ruby_gem/docker/containers/app/Dockerfile.tt', doc_loc, {ruby_version: ruby}
60
+ # # # append_to_file 'docker-compose.yml', "\n app-#{ruby}:\n build:\n\s\s\s\s\s\scontext:"
61
+ # # end
62
+
63
+ # # # end
64
+ # # # <<EOF
65
+ # # # This is the first way of creating
66
+ # # # here document ie. multiple line string.
67
+ # # # EOF
68
+ # # # %w[app web].each do |container|
69
+ # # # options = {
70
+ # # # email: @env_hash['DOCKERHUB_EMAIL'],
71
+ # # # app_name: @env_hash['APP_NAME'] }
72
+ # # #
73
+ # # # template("docker/containers/#{container}/Dockerfile.tt", "docker/containers/#{container}/Dockerfile", options)
74
+ # # # end
75
+ # # end
76
+ # # end
77
+ # # end
@@ -0,0 +1,45 @@
1
+ module Roro
2
+ class CLI < Thor
3
+
4
+ desc "rollon::ruby_gem::with_ci_cd", "Generate files for containerized gem testing, CircleCI, and releasing to RubyGems."
5
+ map "rollon::ruby_gem::with_ci_cd" => "rollon_ruby_gem_with_ci_cd"
6
+
7
+ def rollon_ruby_gem_with_ci_cd(*args)
8
+ ruby_gem_with_ci_cd(*args)
9
+ end
10
+
11
+ no_commands do
12
+ def ruby_gem_with_ci_cd(*args)
13
+ configure_for_rollon
14
+ answer = ask("\nYou can add your rubygems api key in\n\t
15
+ './roro/containers/ruby_gem/ci.env' \n\nlater, or we'll try to add it here:",
16
+ default: '')
17
+ rubygems_api_key = (answer.eql?("") ? 'some-key' : answer)
18
+ @config.app['rubygems_api_key'] = rubygems_api_key
19
+ @config.app['rubies'] = []
20
+ 3.times do |index|
21
+ newruby = @config.app['ruby_version'].gsub('.', '').to_i - index
22
+ @config.app['rubies'] << newruby.to_s.split('').join('.')
23
+ end
24
+ directory 'ruby_gem/roro', './roro', @config.app
25
+ directory 'ruby_gem/.circleci', './.circleci', @config.app
26
+ copy_file 'ruby_gem/docker-compose.yml', './docker-compose.yml'
27
+
28
+ @config.app['rubies'].each do |ruby|
29
+ file = '.circleci/config.yml'
30
+ spacer = "\n - run: "
31
+ rv = "RUBY_VERSION=#{ruby} docker-compose "
32
+ build = "build ruby_gem"
33
+ up = "up -d --force-recreate ruby_gem"
34
+ run_tests = "run ruby_gem bundle exec rake test"
35
+ append_to_file file, spacer + rv + run_tests, after: "- placeholder"
36
+ append_to_file file, spacer + rv + up, after: "- placeholder"
37
+ append_to_file file, spacer + rv + build, after: "- placeholder"
38
+ end
39
+ gsub_file '.circleci/config.yml', "- placeholder", "- checkout"
40
+ append_to_file ".gitignore", "\nGemfile.lock"
41
+ gitignore_sensitive_files
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ require_relative 'ruby_gem/ruby_gem'
2
+
3
+
@@ -1,54 +1,67 @@
1
- module Roro
2
-
3
- class CLI < Thor
1
+ # module Rollon
2
+ # module Story
3
+
4
+ # end
5
+ # end
6
+ # class Rollon::Story::RubyGem < Roro::CLI
7
+ # attr_reader :getsome
8
+ # def initialize
9
+ # @getsome = 'getsome'
10
+ # end
11
+ # end
4
12
 
5
- include Thor::Actions
13
+ # # module Roro
6
14
 
7
- desc "ruby_gem", "Generate files for containerized gem testing, CircleCI, and releasing to RubyGems."
8
- method_option :rubies, type: :array, banner: "2.5.3 2.4.2"
15
+ # # class CLI < Thor
9
16
 
10
- no_commands do
11
- def copy_ruby_gem_files
12
- copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
13
- end
14
- end
15
17
 
16
- def ruby_gem
17
- rubies = options["rubies"] || ["2.5.3", "2.6.0"]
18
- copy_file 'ruby_gem/docker-compose.yml', 'docker-compose.yml'
19
- copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
20
- copy_file 'ruby_gem/setup-gem-credentials.sh', '.circleci/setup-gem-credentials.sh'
21
- directory 'ruby_gem/docker', 'docker', { ruby_version: "2.5"}
18
+ # # no_commands do
19
+
20
+ # # def ruby_gem(*args)
21
+
22
+
23
+ # # end
24
+ # # def copy_ruby_gem_files
25
+ # # copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
26
+ # # end
27
+ # # end
28
+
29
+ # # def ruby_gem
30
+ # # rubies = options["rubies"] || ["2.5.3", "2.6.0"]
31
+ # # copy_file 'ruby_gem/docker-compose.yml', 'docker-compose.yml'
32
+ # # copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
33
+ # # copy_file 'ruby_gem/setup-gem-credentials.sh', '.circleci/setup-gem-credentials.sh'
34
+ # # directory 'ruby_gem/docker', 'docker', { ruby_version: "2.5"}
22
35
 
23
- rubies.each do |ruby|
24
- rubydash = ruby.gsub('.', '-')
25
- rubyunderscore = ruby.gsub('.', '_')
26
- doc_loc = "docker/containers/#{rubyunderscore}/Dockerfile"
27
- content = <<-EOM
36
+ # # rubies.each do |ruby|
37
+ # # rubydash = ruby.gsub('.', '-')
38
+ # # rubyunderscore = ruby.gsub('.', '_')
39
+ # # doc_loc = "docker/containers/#{rubyunderscore}/Dockerfile"
40
+ # # content = <<-EOM
28
41
 
29
- app-#{rubydash}:
30
- build:
31
- context: .
32
- dockerfile: #{doc_loc}
33
- command: rake test
34
- EOM
35
- append_to_file 'docker-compose.yml', content
36
- template 'ruby_gem/docker/containers/app/Dockerfile.tt', doc_loc, {ruby_version: ruby}
37
- # append_to_file 'docker-compose.yml', "\n app-#{ruby}:\n build:\n\s\s\s\s\s\scontext:"
38
- end
42
+ # # app-#{rubydash}:
43
+ # # build:
44
+ # # context: .
45
+ # # dockerfile: #{doc_loc}
46
+ # # command: rake test
47
+ # # EOM
48
+ # # append_to_file 'docker-compose.yml', content
49
+ # # template 'ruby_gem/docker/containers/app/Dockerfile.tt', doc_loc, {ruby_version: ruby}
50
+ # # # append_to_file 'docker-compose.yml', "\n app-#{ruby}:\n build:\n\s\s\s\s\s\scontext:"
51
+ # # end
39
52
 
40
- # end
41
- # <<EOF
42
- # This is the first way of creating
43
- # here document ie. multiple line string.
44
- # EOF
45
- # %w[app web].each do |container|
46
- # options = {
47
- # email: @env_hash['DOCKERHUB_EMAIL'],
48
- # app_name: @env_hash['APP_NAME'] }
49
- #
50
- # template("docker/containers/#{container}/Dockerfile.tt", "docker/containers/#{container}/Dockerfile", options)
51
- # end
52
- end
53
- end
54
- end
53
+ # # # end
54
+ # # # <<EOF
55
+ # # # This is the first way of creating
56
+ # # # here document ie. multiple line string.
57
+ # # # EOF
58
+ # # # %w[app web].each do |container|
59
+ # # # options = {
60
+ # # # email: @env_hash['DOCKERHUB_EMAIL'],
61
+ # # # app_name: @env_hash['APP_NAME'] }
62
+ # # #
63
+ # # # template("docker/containers/#{container}/Dockerfile.tt", "docker/containers/#{container}/Dockerfile", options)
64
+ # # # end
65
+ # # end
66
+ # # end
67
+ # # end
@@ -1,5 +1,4 @@
1
1
  .git
2
- .gitignore
3
2
  README.md
4
3
 
5
4
  #
@@ -30,7 +29,8 @@ Temporary Items
30
29
  *.rbc
31
30
  capybara-*.html
32
31
  log
33
- tmp
32
+ tmp/*
33
+ !tmp/.keep
34
34
  db/*.sqlite3
35
35
  db/*.sqlite3-journal
36
36
  public/system
@@ -1,4 +1,3 @@
1
1
  <% config['mysql_env_vars'].each do |k,v| %><%= "\n" + k + "=" + v %><% end %>
2
2
  MYSQL_DATABASE=<%= config['main_app_name'] + "_db"%>
3
3
  RAILS_ENV=<%= config['rails_env'] %>
4
- RAILS_LOG_TO_STDOUT=true
@@ -1,5 +1,4 @@
1
1
  <% config['postgresql_env_vars'].each do |k,v| %><%= "\n" + k + "=" + v %><% end %>
2
2
  POSTGRES_DB=<%= config['main_app_name'] + "_" + config['rails_env'] %>
3
3
  RAILS_ENV=<%= config['rails_env'] %>
4
- RAILS_LOG_TO_STDOUT=true
5
4
 
@@ -1 +1,2 @@
1
1
  DATABASE_HOST=database
2
+ RAILS_LOG_TO_STDOUT=true
@@ -1,44 +1,82 @@
1
+ ## The FROM instruction below builds our first layer using an official image:
1
2
  FROM ruby:<%= config['ruby_version'] %>
3
+
2
4
  LABEL maintainer="<%= config['dockerhub_email'] %>"
3
5
 
6
+ ## This is a rails app so, we will want to add node and yarn. In order for our
7
+ ## container to trust yarn as a source, we first need to add yarn's public key.
8
+ ## One good way to accomplish this is with apt-key, but apt-key is designed to
9
+ ## send output to the terminal and not to stdout, and thus apt-key will send a
10
+ ## warning message during the build context. One way to deal with the warning
11
+ ## is to set an environment variable telling apt-get to be quiet. To do this,
12
+ ## you'd first write an ENV instruction setting the environment variable, then
13
+ ## write the RUN instruction adding the key to the container, and then you'd
14
+ ## have to write another ENV instruction unsetting the variable. This would be
15
+ ## ugly and inconvenient. Another way to deal with the warning is to just ignore
16
+ ## it. There's no shame in that but ignoring it in the build context might
17
+ ## condition us to ignore it in other contexts. But what if there was a way to
18
+ ## deal with it that allowed you to set that variable just for the build
19
+ ## context? Fortunately there is, using the ARG instruction. Variables set with
20
+ ## ARG instructions stay in the build context while those set with ENV
21
+ ## instructions follow into the container.
22
+
23
+ ## Use an ARG instruction to set a variable disabling the apt-key warning:
24
+ ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
4
25
 
5
- ## Make sure we have yarn properly sourced:
26
+ ## Add yarn's public key using apt-key:
6
27
  RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
28
+
29
+ ## Add yarn to our sources:
7
30
  RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
8
31
 
9
- ## Update OS and download yarm from source specified above:
32
+
33
+ ## Build a layer updating the image while adding node and yarn from the source
34
+ ## above:
10
35
  RUN apt-get update -qq && apt-get install -y build-essential git nodejs yarn
11
36
 
12
- ## Set up our workspace directories:
13
- ENV APP_HOME /usr/src/app/
14
- RUN mkdir ${APP_HOME}
37
+ ## We have two directories we'd like to follow from the build context into
38
+ ## our containers. APP_HOME is where we'll do most of our work and BUNDLE_PATH
39
+ ## is where we want bundler to store our gems.
15
40
 
16
- ## Tell bundler where to store downloaded gems:
41
+ ## Set APP_HOME and BUNDLE_PATH as using ENV instructions:
42
+ ENV APP_HOME /usr/src/app/
17
43
  ENV BUNDLE_PATH /gems
18
- RUN mkdir ${BUNDLE_PATH}}
44
+
45
+ ## Create both as directories to make sure they exist:
46
+ RUN mkdir ${APP_HOME}
47
+ RUN mkdir ${BUNDLE_PATH}
19
48
 
20
49
  ## Tell Docker to create volumes for our workspace and gems
21
50
  ## so other containers can access them.
22
51
  VOLUME ${APP_HOME}
23
- VOLUME /gems
52
+ VOLUME ${BUNDLE_PATH}
53
+
54
+ ## If we copy our entire app using a single COPY instruction, Docker will build
55
+ ## it all as a single new layer. When Docker notices a change to a file, it then
56
+ ## has to rebuild the entire layer. This can slow development. One way to speed
57
+ ## it back up is to break a single big COPY layer into several smaller ones,
58
+ ## with slow-building layers that don't change often underneath smaller,
59
+ ## lighter, qucker oens that might change a lot.
24
60
 
25
- ## To speed up development, copy Gemfile and Gemfile.lock from host
26
- ## and then bundle so changing other parts of the app don't trigger
27
- ## a full gem install.
61
+ ## Build your big, slow gem layer by first copying your Gemfile && Gemfile.lock:
28
62
  COPY Gemfile* ./
29
63
 
64
+ ## Set your work directory:
30
65
  WORKDIR ${APP_HOME}
31
66
 
67
+ ## build the bundle layer, which now only runs if your Gemfile changes:
32
68
  RUN bundle
33
69
 
70
+ ## Now build a layer layer with everything in your app that's likely to change
71
+ ## frequently. If you make a change to any of these files, only this layer has
72
+ ## to rebuild. smaller, lighter layer
73
+ COPY . ${APP_HOME}
74
+
75
+
34
76
  COPY roro/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
35
77
  RUN chmod +x /usr/bin/docker-entrypoint.sh
36
78
  ENTRYPOINT ["docker-entrypoint.sh"]
37
79
 
38
- COPY . /usr/src/app/
39
-
40
- # RUN chmod +x /usr/src/app/roro/docker-entrypoint.sh
41
- # ENTRYPOINT ["/usr/src/app/roro/docker-entrypoint.sh"]
42
80
 
43
81
 
44
82