dockerfile-rails 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a853a1d2a0a40c1912a99dd77fe1664abe12bf1678eb4dc07a17873259bc39
|
4
|
+
data.tar.gz: 90bcd80ae9f8a6c8c27cc806235bdec6b9bf308ca3a3ebf10712304f7a52a10e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 693b078d6d664fdd7366c036dbbb9f95732c79b0f058a2bfe7300c886c479885b33ba075d9d598a1266b2a030bf6bfc588aee6c9074a570e6bd9720749765d28
|
7
|
+
data.tar.gz: a74d6fe97db12495762f5b6dfcd5ff3cf9c32f2807f9402f9e159f485a5e5c8562347811d12fbdf7601ce6755592c7413ebb6402b2c8c606a90c7c0d5e43148e
|
data/README.md
CHANGED
@@ -17,6 +17,7 @@ General options:
|
|
17
17
|
|
18
18
|
* `--force` - overwrite existing files
|
19
19
|
* `--ci` - include test gems in deployed image
|
20
|
+
* `--platform=s` - specify target platform. See [FROM](https://docs.docker.com/engine/reference/builder/#from) for details.
|
20
21
|
* `--cache` - use build caching to speed up builds
|
21
22
|
* `--parallel` - use multi-stage builds to install gems and node modules in parallel
|
22
23
|
* `--compose` - generate a `docker-compose.yml` file
|
@@ -36,8 +37,8 @@ Optimizations:
|
|
36
37
|
|
37
38
|
* `--fullstaq` - use [fullstaq](https://fullstaqruby.org/) [images](https://github.com/evilmartians/fullstaq-ruby-docker) on [quay.io](https://quay.io/repository/evl.ms/fullstaq-ruby?tab=tags&tag=latest)
|
38
39
|
* `--jemalloc` - use [jemalloc](https://jemalloc.net/) memory allocator
|
39
|
-
* `--yjit` - enable [YJIT](https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md) optimizing compiler
|
40
|
-
* `--swap=n` - allocate swap space. See [falloc options](https://man7.org/linux/man-pages/man1/fallocate.1.html#OPTIONS) for suffixes
|
40
|
+
* `--yjit` - enable [YJIT](https://github.com/ruby/ruby/blob/master/doc/yjit/yjit.md) optimizing compiler
|
41
|
+
* `--swap=n` - allocate swap space. See [falloc options](https://man7.org/linux/man-pages/man1/fallocate.1.html#OPTIONS) for suffixes
|
41
42
|
|
42
43
|
Links:
|
43
44
|
|
@@ -30,6 +30,9 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
30
30
|
class_option :mysql, type: :boolean, default: false,
|
31
31
|
desc: 'include mysql libraries'
|
32
32
|
|
33
|
+
class_option :platform, type: :string, default: nil,
|
34
|
+
desc: 'image platform (example: linux/arm64)'
|
35
|
+
|
33
36
|
class_option :jemalloc, type: :boolean, default: false,
|
34
37
|
desc: 'use jemalloc alternative malloc implementation'
|
35
38
|
|
@@ -81,6 +84,14 @@ private
|
|
81
84
|
ERB.new(template, trim_mode: '-').result(scope.get_binding).strip
|
82
85
|
end
|
83
86
|
|
87
|
+
def platform
|
88
|
+
if options.platform
|
89
|
+
"--platform #{options.platform} "
|
90
|
+
else
|
91
|
+
""
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
84
95
|
def using_node?
|
85
96
|
return @using_node if @using_node != nil
|
86
97
|
@using_node = File.exist? 'package.json'
|
@@ -8,9 +8,9 @@ ARG RUBY_VERSION=<%= RUBY_VERSION %>
|
|
8
8
|
|
9
9
|
<% end -%>
|
10
10
|
<% if options.fullstaq -%>
|
11
|
-
FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-<%= @options.jemalloc ? 'jemalloc-' : '' %>slim as base
|
11
|
+
FROM <%= platform %>quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-<%= @options.jemalloc ? 'jemalloc-' : '' %>slim as base
|
12
12
|
<% else -%>
|
13
|
-
FROM ruby:$RUBY_VERSION-slim as base
|
13
|
+
FROM <%= platform %>ruby:$RUBY_VERSION-slim as base
|
14
14
|
<% end -%>
|
15
15
|
|
16
16
|
# Rails app lives here
|
@@ -124,7 +124,11 @@ COPY --from=client /rails/<%= api_client_dir %>/build /rails/public
|
|
124
124
|
ENV RAILS_LOG_TO_STDOUT="1" \
|
125
125
|
RAILS_SERVE_STATIC_FILES="true"<% if options.yjit %> \
|
126
126
|
RUBY_YJIT_ENABLE="1"<% end %><% if options.jemalloc and not options.fullstaq %> \
|
127
|
+
<% if (options.platform || Gem::Platform::local.cpu).include? 'arm' -%>
|
128
|
+
LD_PRELOAD="/usr/lib/aarch64-linux-gnu/libjemalloc.so.2" \
|
129
|
+
<% else -%>
|
127
130
|
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" \
|
131
|
+
<% end -%>
|
128
132
|
MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true"<% end %>
|
129
133
|
|
130
134
|
# Entrypoint prepares the database.
|