roro 0.3.5 → 0.3.12

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +15 -2
  3. data/Guardfile +4 -10
  4. data/lib/roro.rb +0 -1
  5. data/lib/roro/cli.rb +75 -5
  6. data/lib/roro/cli/base/base.rb +2 -1
  7. data/lib/roro/cli/base/base_files.rb +1 -7
  8. data/lib/roro/cli/base/check_dependencies.rb +98 -0
  9. data/lib/roro/cli/base/insert_gems.rb +15 -7
  10. data/lib/roro/cli/base/insertions.rb +3 -1
  11. data/lib/roro/cli/cli.rb +99 -0
  12. data/lib/roro/cli/configuration.rb +69 -0
  13. data/lib/roro/cli/expose.rb +8 -7
  14. data/lib/roro/cli/generate/config.rb +13 -0
  15. data/lib/roro/cli/generate/config/rails.rb +17 -0
  16. data/lib/roro/cli/generate/generate.rb +1 -0
  17. data/lib/roro/cli/generate/generate_keys.rb +47 -0
  18. data/lib/roro/cli/greenfield.rb +20 -31
  19. data/lib/roro/cli/obfuscate.rb +10 -11
  20. data/lib/roro/cli/rollon.rb +67 -21
  21. data/lib/roro/cli/rollon/stories.rb +2 -3
  22. data/{.keep → lib/roro/cli/rollon/stories/database.rb} +0 -0
  23. data/lib/roro/cli/rollon/stories/rails.rb +1 -0
  24. data/lib/roro/cli/{templates/base/roro → rollon/stories/rails}/.keep +0 -0
  25. data/lib/roro/cli/rollon/stories/rails/database.rb +33 -0
  26. data/lib/roro/cli/rollon/stories/rails/database/with_mysql.rb +22 -0
  27. data/lib/roro/cli/rollon/stories/rails/database/with_postgresql.rb +21 -0
  28. data/lib/roro/cli/rollon/stories/ruby_gem.rb +77 -0
  29. data/lib/roro/cli/rollon/stories/ruby_gem/with_ci_cd.rb +81 -0
  30. data/lib/roro/cli/rollon/stories/stories.rb +3 -0
  31. data/lib/roro/cli/roro_configurator.yml +157 -0
  32. data/lib/roro/cli/ruby_gem.rb +60 -47
  33. data/lib/roro/cli/templates/base/.roro_config.yml +15 -0
  34. data/lib/roro/cli/templates/base/Dockerfile.tt +82 -0
  35. data/lib/roro/cli/templates/base/config/database.mysql.yml +19 -0
  36. data/lib/roro/cli/templates/base/config/{database.yml.pg.tt → database.pg.yml} +0 -0
  37. data/lib/roro/cli/templates/greenfield/Dockerfile.tt +29 -7
  38. data/lib/roro/cli/templates/{base/livereload → livereload}/hosts.example +0 -0
  39. data/lib/roro/cli/templates/{base/roro/containers → roro}/.keep +0 -0
  40. data/lib/roro/cli/templates/{greenfield → roro}/docker-compose.yml.tt +18 -13
  41. data/lib/roro/cli/templates/{base/roro/containers/app → roro/roro}/.keep +0 -0
  42. data/lib/roro/cli/templates/{base/roro/containers/frontend → roro/roro/containers}/.keep +0 -0
  43. data/lib/roro/cli/templates/{dockerize/.env → roro/roro/containers/app}/.keep +0 -0
  44. data/lib/roro/cli/templates/{dockerize/.env/development → roro/roro/containers/frontend}/.keep +0 -0
  45. data/lib/roro/cli/templates/{quickstart/entrypoint.sh → roro/roro/docker-entrypoint.sh.tt} +1 -1
  46. data/lib/roro/cli/templates/ruby_gem/.circleci/config.yml +17 -0
  47. data/lib/roro/cli/templates/ruby_gem/docker-compose.yml +6 -4
  48. data/lib/roro/cli/templates/ruby_gem/roro/ci.env.tt +1 -0
  49. data/lib/roro/cli/templates/{dockerize → ruby_gem/roro/containers}/.keep +0 -0
  50. data/lib/roro/cli/templates/ruby_gem/roro/containers/ruby_image/Dockerfile.tt +16 -0
  51. data/lib/roro/cli/templates/ruby_gem/{docker/env_files → roro/keys}/.keep +0 -0
  52. data/lib/roro/cli/templates/{ruby_gem/docker/keys → stories}/.keep +0 -0
  53. data/lib/roro/cli/templates/stories/with_mysql/_service.yml +10 -0
  54. data/lib/roro/cli/templates/stories/with_postgresql/.keep +0 -0
  55. data/lib/roro/cli/templates/stories/with_postgresql/_service.yml +7 -0
  56. data/lib/roro/version.rb +1 -1
  57. data/roro.gemspec +3 -4
  58. data/sandbox/.keep +0 -0
  59. data/vendor/cache/concurrent-ruby-1.1.7.gem +0 -0
  60. data/vendor/cache/gem-release-2.1.1.gem +0 -0
  61. metadata +69 -66
  62. data/lib/roro/cli/base/configuration.rb +0 -118
  63. data/lib/roro/cli/generate_keys.rb +0 -79
  64. data/lib/roro/cli/rollon/rollon_as_dockerize.rb +0 -42
  65. data/lib/roro/cli/rollon/rollon_as_quickstart.rb +0 -17
  66. data/lib/roro/cli/rollon/rollon_as_roro.rb +0 -30
  67. data/lib/roro/cli/templates/base/circleci/config.yml.tt +0 -70
  68. data/lib/roro/cli/templates/base/docker-compose.yml.tt +0 -53
  69. data/lib/roro/cli/templates/base/pg/config/database.yml.pg.tt +0 -20
  70. data/lib/roro/cli/templates/base/pg/database.yml.pg.tt +0 -20
  71. data/lib/roro/cli/templates/base/roro/containers/app/Dockerfile.tt +0 -32
  72. data/lib/roro/cli/templates/base/roro/containers/app/development.env.tt +0 -1
  73. data/lib/roro/cli/templates/base/roro/containers/app/docker-entrypoint.sh +0 -8
  74. data/lib/roro/cli/templates/base/roro/containers/app/test.env.tt +0 -1
  75. data/lib/roro/cli/templates/base/roro/containers/database/development.env.tt +0 -4
  76. data/lib/roro/cli/templates/base/roro/containers/database/test.env.tt +0 -4
  77. data/lib/roro/cli/templates/dockerize/.env/development/database +0 -3
  78. data/lib/roro/cli/templates/dockerize/.env/development/web +0 -1
  79. data/lib/roro/cli/templates/dockerize/Dockerfile.tt +0 -23
  80. data/lib/roro/cli/templates/dockerize/docker-compose.yml.tt +0 -60
  81. data/lib/roro/cli/templates/dockerize/docker-entrypoint.sh +0 -9
  82. data/lib/roro/cli/templates/quickstart/Dockerfile.tt +0 -20
  83. data/lib/roro/cli/templates/quickstart/database.yml +0 -85
  84. data/lib/roro/cli/templates/quickstart/docker-compose.yml +0 -17
  85. data/lib/roro/cli/templates/ruby_gem/.gitignore +0 -8
  86. data/lib/roro/cli/templates/ruby_gem/config.yml +0 -122
  87. data/lib/roro/cli/templates/ruby_gem/docker/containers/app/Dockerfile.tt +0 -10
  88. data/roro-0.3.4.gem +0 -0
  89. data/vendor/cache/concurrent-ruby-1.1.6.gem +0 -0
@@ -0,0 +1,81 @@
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
+ method_option :rubies, type: :array, banner: "2.5.3 2.4.2"
6
+ map "rollon::ruby_gem::with_ci_cd" => "rollon_ruby_gem_with_ci_cd"
7
+
8
+ def rollon_ruby_gem_with_ci_cd(*args)
9
+ ruby_gem_with_ci_cd(*args)
10
+ end
11
+
12
+ no_commands do
13
+ def ruby_gem_with_ci_cd(*args)
14
+ configure_for_rollon
15
+ answer = ask("\nYou can add your rubygems api key in\n\t
16
+ './roro/ci.env' \n\nlater, or we'll try to add it here:",
17
+ default: '')
18
+ rubygems_api_key = (answer.eql?("") ? 'some-key' : answer)
19
+ @config.app['rubygems_api_key'] = rubygems_api_key
20
+ @config.app['rubies'] = []
21
+ 3.times do |index|
22
+ newruby = @config.app['ruby_version'].gsub('.', '').to_i - index
23
+ @config.app['rubies'] << newruby.to_s.split('').join('.')
24
+ end
25
+ directory 'ruby_gem/roro', './roro', @config.app
26
+ directory 'ruby_gem/.circleci', './.circleci', @config.app
27
+ copy_file 'ruby_gem/docker-compose.yml', './docker-compose.yml'
28
+
29
+ @config.app['rubies'].each do |ruby|
30
+ img_name = 'ruby_gem:' + ruby
31
+ file = '.circleci/config.yml'
32
+
33
+ run_build = "\n - run: RUBY_IMAGE=ruby:#{ruby}-alpine docker-compose build ruby_gem"
34
+ run_test = "\n - run: RUBY_IMAGE=ruby:#{ruby}-alpine docker-compose run ruby_gem rake test"
35
+ append_to_file file, run_build + run_test, after: 'gem install roro'
36
+ end
37
+ append_to_file ".gitignore", "\nGemfile.lock"
38
+ gitignore_sensitive_files
39
+ end
40
+ end
41
+ end
42
+ end
43
+ # # def ruby_gem
44
+ # # rubies = options["rubies"] || ["2.5.3", "2.6.0"]
45
+ # # copy_file 'ruby_gem/docker-compose.yml', 'docker-compose.yml'
46
+ # # copy_file 'ruby_gem/config.yml', '.circleci/config.yml'
47
+ # # copy_file 'ruby_gem/setup-gem-credentials.sh', '.circleci/setup-gem-credentials.sh'
48
+ # # directory 'ruby_gem/docker', 'docker', { ruby_version: "2.5"}
49
+
50
+ # # rubies.each do |ruby|
51
+ # # rubydash = ruby.gsub('.', '-')
52
+ # # rubyunderscore = ruby.gsub('.', '_')
53
+ # # doc_loc = "docker/containers/#{rubyunderscore}/Dockerfile"
54
+ # # content = <<-EOM
55
+
56
+ # # app-#{rubydash}:
57
+ # # build:
58
+ # # context: .
59
+ # # dockerfile: #{doc_loc}
60
+ # # command: rake test
61
+ # # EOM
62
+ # # append_to_file 'docker-compose.yml', content
63
+ # # template 'ruby_gem/docker/containers/app/Dockerfile.tt', doc_loc, {ruby_version: ruby}
64
+ # # # append_to_file 'docker-compose.yml', "\n app-#{ruby}:\n build:\n\s\s\s\s\s\scontext:"
65
+ # # end
66
+
67
+ # # # end
68
+ # # # <<EOF
69
+ # # # This is the first way of creating
70
+ # # # here document ie. multiple line string.
71
+ # # # EOF
72
+ # # # %w[app web].each do |container|
73
+ # # # options = {
74
+ # # # email: @env_hash['DOCKERHUB_EMAIL'],
75
+ # # # app_name: @env_hash['APP_NAME'] }
76
+ # # #
77
+ # # # template("docker/containers/#{container}/Dockerfile.tt", "docker/containers/#{container}/Dockerfile", options)
78
+ # # # end
79
+ # # end
80
+ # # end
81
+ # # end
@@ -0,0 +1,3 @@
1
+ require_relative 'ruby_gem/ruby_gem'
2
+
3
+
@@ -0,0 +1,157 @@
1
+ ---
2
+ main_app_name: <%= Dir.pwd.split('/').last %>
3
+ developer:
4
+ name: your-name
5
+ email: your.email@example.com
6
+
7
+ services:
8
+ server_app:
9
+ name: app
10
+ vendors:
11
+ rails:
12
+ version:
13
+ image:
14
+ official_name: ruby
15
+ variants:
16
+ - alpine
17
+ - buster
18
+ - slim
19
+ - slim-buster
20
+ - stretch
21
+
22
+ choices:
23
+
24
+ config_std_out_true:
25
+ question: |
26
+ The team at Heroku, among others, recommend logging to STDOUT
27
+ and treating your logs as streams. We'll set this to
28
+ true as an environment variable but it may also be helpful
29
+ to configure './config/boot.rb' with '$stdout.sync = true'
30
+ just in case that doesn't work.
31
+ Would you like to configure this?
32
+ choices:
33
+ y: 'Yes'
34
+ n: 'No'
35
+ default: y
36
+
37
+ insert_roro_gem_into_gemfile:
38
+ question: |
39
+ Many developers believe it's good idea to secure sensitive
40
+ environment files and variables. You can use RoRo to
41
+ generate secret keys known only to you for use in any
42
+ environment, and then use them to encrypt and decrypt
43
+ these files. Would you like to add RoRo to your Gemfile?
44
+ choices:
45
+ y: 'Yes'
46
+ n: 'No'
47
+ default: y
48
+
49
+ gitignore_sensitive_files:
50
+ question: |
51
+ If you plan to use the environment files RoRo generates for
52
+ your own environment variables, it's a good idea to keep
53
+ these files out of source control. Would you like RoRo to
54
+ modify your .gitignore file to accomplish this for you ?
55
+ choices:
56
+ y: 'Yes'
57
+ n: 'No'
58
+ default: y
59
+
60
+ insert_hfci_gem_into_gemfile:
61
+ question: |
62
+ Jim Weirich passed too soon and remains missed. In addition
63
+ to Rake, Jim wrote a beautiful gem called 'Given' that makes
64
+ Rspec and Minitest less ugly and thus your tests more easy to
65
+ write. Would you like to install a gem called
66
+ handsome_fencer-test that allows you to try it out?
67
+ choices:
68
+ y: 'Yes'
69
+ n: 'No'
70
+ default: n
71
+
72
+ backup_existing_files:
73
+ question: |
74
+ RoRo will be generating a number of files, some of which will
75
+ replace existing ones. Would you like to back them up?
76
+ choices:
77
+ y: 'Yes'
78
+ n: 'No'
79
+ default: n
80
+
81
+ copy_dockerignore:
82
+ question: |
83
+ Would you like to create a .dockerignore file?
84
+ choices:
85
+ y: 'Yes'
86
+ n: 'No'
87
+ default: y
88
+
89
+ configure_database:
90
+ question: |
91
+ RoRo can reliably dockerize your Rails app with either
92
+ MySQL or PostgreSQL stories. Which story would you prefer
93
+ to roll on?
94
+ choices:
95
+ p: PostgreSQL
96
+ m: MySQL
97
+ default: p
98
+
99
+ env_vars:
100
+ DATABASE_HOST: database
101
+
102
+ database:
103
+ name: database
104
+ vendor: postgresql
105
+ vendors:
106
+ postgresql:
107
+ images:
108
+ official_name:
109
+ versions:
110
+ - latest
111
+ env_vars:
112
+ POSTGRES_USER: postgres
113
+ POSTGRES_PASSWORD: your-postgres-password
114
+
115
+ mysql:
116
+ env_vars:
117
+ MYSQL_ROOT_PASSWORD: root
118
+ MYSQL_PASSWORD: root
119
+ MYSQL_USERNAME: root
120
+ MYSQL_DATABASE_PORT: '3306'
121
+
122
+ frontend:
123
+ name: frontend
124
+ vendors:
125
+
126
+ - frontend
127
+ - vuejs
128
+ - react
129
+ - angular
130
+ webserver:
131
+ default: nginx
132
+ vendors:
133
+ - nginx
134
+ application_server:
135
+ name: appserver
136
+ vendors:
137
+ - unicorn:
138
+ - puma:
139
+ registries:
140
+ dockerhub:
141
+ env_vars:
142
+ DOCKERHUB_EMAIL: your-docker-hub-email
143
+ DOCKERHUB_ORG: your-docker-hub-org-name
144
+ DOCKERHUB_PASSWORD: your-docker-hub-password
145
+ DOCKERHUB_USER: your-docker-hub-user-name
146
+
147
+ ci_cd:
148
+ semaphore:
149
+ circleci:
150
+ env_vars:
151
+ DEPLOY_TAG: "${CIRCLE_SHA1:0:7}"
152
+
153
+ deployment:
154
+ env_vars:
155
+ SERVER_HOST: "ip-address-of-your-server"
156
+ SERVER_PORT: '22'
157
+ SERVER_USER: root
@@ -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
@@ -0,0 +1,15 @@
1
+ ---
2
+ main_app_name: greenfield
3
+ database_host: database
4
+ ruby_version: '2.7'
5
+ frontend_service: frontend
6
+ webserver_service: nginx
7
+ database_service: database
8
+ database_vendor: mysql
9
+ mysql_env_vars:
10
+ MYSQL_ROOT_PASSWORD: root
11
+ MYSQL_PASSWORD: root
12
+ MYSQL_USERNAME: root
13
+ MYSQL_DATABASE_PORT: '3306'
14
+ thor_actions:
15
+ insert_hfci_gem_into_gemfile: y
@@ -0,0 +1,82 @@
1
+ ## The FROM instruction below builds our first layer using an official image:
2
+ FROM ruby:<%= config['ruby_version'] %>
3
+
4
+ LABEL maintainer="<%= config['dockerhub_email'] %>"
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
25
+
26
+ ## Add yarn's public key using apt-key:
27
+ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
28
+
29
+ ## Add yarn to our sources:
30
+ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
31
+
32
+
33
+ ## Build a layer updating the image while adding node and yarn from the source
34
+ ## above:
35
+ RUN apt-get update -qq && apt-get install -y build-essential git nodejs yarn
36
+
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.
40
+
41
+ ## Set APP_HOME and BUNDLE_PATH as using ENV instructions:
42
+ ENV APP_HOME /usr/src/app/
43
+ ENV BUNDLE_PATH /gems
44
+
45
+ ## Create both as directories to make sure they exist:
46
+ RUN mkdir ${APP_HOME}
47
+ RUN mkdir ${BUNDLE_PATH}
48
+
49
+ ## Tell Docker to create volumes for our workspace and gems
50
+ ## so other containers can access them.
51
+ VOLUME ${APP_HOME}
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.
60
+
61
+ ## Build your big, slow gem layer by first copying your Gemfile && Gemfile.lock:
62
+ COPY Gemfile* ./
63
+
64
+ ## Set your work directory:
65
+ WORKDIR ${APP_HOME}
66
+
67
+ ## build the bundle layer, which now only runs if your Gemfile changes:
68
+ RUN bundle
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
+
76
+ COPY roro/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
77
+ RUN chmod +x /usr/bin/docker-entrypoint.sh
78
+ ENTRYPOINT ["docker-entrypoint.sh"]
79
+
80
+
81
+
82
+