dockerfile-rails 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/dockerfile-rails/scanner.rb +1 -1
- data/lib/generators/dockerfile_generator.rb +26 -0
- data/lib/generators/templates/Dockerfile.erb +3 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5146ba972235a473c3018799f3b75bc7856dad4c7c1e1b34a9fc0e87aa0de196
|
4
|
+
data.tar.gz: f9848a9d5103550a9fe7e1be7ee3820d4f99cee50ec39cc53933f568ffe29357
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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)
|
@@ -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
|
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.
|
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-
|
11
|
+
date: 2023-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|