dockerfile-rails 0.5.0 → 0.5.1

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: 906eaaf2f4166356a6cece9b347dd58a29324a0e7a3d0f557cfea85054c34816
4
- data.tar.gz: 0c071eb1fd4da339676916705498c18fb2d5e08e0115b8f47745def8229390e3
3
+ metadata.gz: 5146ba972235a473c3018799f3b75bc7856dad4c7c1e1b34a9fc0e87aa0de196
4
+ data.tar.gz: f9848a9d5103550a9fe7e1be7ee3820d4f99cee50ec39cc53933f568ffe29357
5
5
  SHA512:
6
- metadata.gz: 66b27141d048276513a4384b6dd88fae87f929d2128a9e6a19187cac6a1d75f751d5e261ccd4f94424ae7ae53ca0713141db34163d04cb997a719731a6e39dde
7
- data.tar.gz: 7e927389954e205c3cc89e6de75506d85265ac394a749f0b394d9b5263b4de719a5dc935d8ff493f1c1cfdc30854b70f7f5b77f6c48599095a7132f0f050a0cd
6
+ metadata.gz: 14b6231959a35395703f0019a2c4e38062dd6b8d37d2c5c936dad2920c120118f7c95ad80a4c4d6591449bc2c79fc86c4ffd35bf3ac107ca6894291906ddd23b
7
+ data.tar.gz: d62ba6ea16c3705de8bc1606d8c1adbca6c91e591ff949d0d132f7f47b315662cc2659919a25febe9628dce5b7a9c34e5215dba0081b79525f6dae99b0fe4c3b
data/README.md CHANGED
@@ -9,7 +9,7 @@ Provides a Rails generator to produce Dockerfiles and related files. This is be
9
9
  ## Usage
10
10
 
11
11
  ```
12
- bundle add dockerfile-rails --group development
12
+ bundle add dockerfile-rails --version ">= 0.5.0" --group development
13
13
  bin/rails generate dockerfile
14
14
  ```
15
15
 
@@ -77,3 +77,4 @@ Many of the following links relate to the current development status with respec
77
77
  * [Rails Dockerfile futures](https://discuss.rubyonrails.org/t/rails-dockerfile-futures/82091/1) - rationale for a generator
78
78
  * [Fly Cookbooks](https://fly.io/docs/rails/cookbooks/) - deeper dive into Dockerfile design choices
79
79
  * [app/templates/Dockerfile.tt](https://github.com/rails/rails/blob/main/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt) - current Rails 7.1 template
80
+ * Fly.io [Cut over to Rails Dockerfile Generator on Sunday 29 Jan 2023](https://community.fly.io/t/cut-over-to-rails-dockerfile-generator-on-sunday-29-jan-2023/10350)
@@ -4,7 +4,7 @@ module DockerfileRails
4
4
 
5
5
  ### database ###
6
6
 
7
- database = YAML.load_file('config/database.yml').
7
+ database = YAML.load_file('config/database.yml', aliases: true).
8
8
  dig('production', 'adapter') rescue nil
9
9
 
10
10
  if database == 'sqlite3'
@@ -14,6 +14,7 @@ class DockerfileGenerator < Rails::Generators::Base
14
14
  'mysql' => false,
15
15
  'parallel' => false,
16
16
  'platform' => nil,
17
+ 'postgresql' => false,
17
18
  'prepare' => true,
18
19
  'redis' => false,
19
20
  'swap' => nil,
@@ -224,6 +225,31 @@ private
224
225
  packages.sort
225
226
  end
226
227
 
228
+ def deploy_env
229
+ env = []
230
+
231
+ if Rails::VERSION::MAJOR<7 || Rails::VERSION::STRING.start_with?('7.0')
232
+ env << 'RAILS_LOG_TO_STDOUT="1"'
233
+ env << 'RAILS_SERVE_STATIC_FILES="true"'
234
+ end
235
+
236
+ if options.yjit
237
+ env << 'RUBY_YJIT_ENABLE="1"'
238
+ end
239
+
240
+ if options.jemalloc and not options.fullstaq
241
+ if (options.platform || Gem::Platform::local.cpu).include? 'arm'
242
+ env << 'LD_PRELOAD="/usr/lib/aarch64-linux-gnu/libjemalloc.so.2"'
243
+ else
244
+ env << 'LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"'
245
+ end
246
+
247
+ env << 'MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true"'
248
+ end
249
+
250
+ env
251
+ end
252
+
227
253
  def binfile_fixups
228
254
  # binfiles may have OS specific paths to ruby. Normalize them.
229
255
  shebangs = Dir["bin/*"].map { |file| IO.read(file).lines.first }.join
@@ -126,17 +126,11 @@ COPY --from=build /rails /rails
126
126
  COPY --from=client /rails/<%= api_client_dir %>/build /rails/public
127
127
  <% end -%>
128
128
 
129
+ <% unless deploy_env.empty? -%>
129
130
  # Deployment options
130
- ENV RAILS_LOG_TO_STDOUT="1" \
131
- RAILS_SERVE_STATIC_FILES="true"<% if options.yjit %> \
132
- RUBY_YJIT_ENABLE="1"<% end %><% if options.jemalloc and not options.fullstaq %> \
133
- <% if (options.platform || Gem::Platform::local.cpu).include? 'arm' -%>
134
- LD_PRELOAD="/usr/lib/aarch64-linux-gnu/libjemalloc.so.2" \
135
- <% else -%>
136
- LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" \
137
- <% end -%>
138
- MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true"<% end %>
131
+ ENV <%= deploy_env.join(" \\\n ") %>
139
132
 
133
+ <% end -%>
140
134
  <% if options.prepare -%>
141
135
  # Entrypoint prepares the database.
142
136
  <% else -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerfile-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails