dockerfile-rails 0.3.1 → 0.4.0

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: c7b0eaffe4eadbac03e5393587f0377220a8dfd335f098d39a0c688e3d87aa90
4
- data.tar.gz: 9b83eb7efda7065551580efcd0966e1609c6e52f85c8619a8cc193340dd0a696
3
+ metadata.gz: 438d7f814f08f6180930a72f8b2e6437cb3b53b45ff495d99a0e5abf5c85e361
4
+ data.tar.gz: 71d21d72fc2aea9062fa9ba15e491083d279caa050f264e36de424a42e70ef44
5
5
  SHA512:
6
- metadata.gz: 030eebde1411bfd630bcb55f7120e439c39787d5b0ce791ffee804edd21223672ec567f2923c18cc5f7716458e300b31bf74971255858bd48f883a1f137e7b57
7
- data.tar.gz: 9e4e0a31577564dc9fabb969b092b33d370794c5d62658b5bb513bb4cb342c37f0350a4bfe2ed48477e864e78249cce48463a69ff624b13c76b8b2c024855ee7
6
+ metadata.gz: eb59c4587e1f9b0b9dbd93b7e71e49a2211659bb3e8c9c9a58919f39b3d30963a41b954ad182c418c19df2edabbf68578494bce069306bc1947c18af1fcf1c7a
7
+ data.tar.gz: d3c30f95c8f17c44e1f4bc09639ed67a246e6d3b10646a758602bf97937e0da54507e1156b9728261a15ebba8de6618266002b5e6b5b02699bf0661f45da128b
data/lib/erbtest.rb ADDED
@@ -0,0 +1,41 @@
1
+ TEMPLATE = <<-EOF
2
+ value is <%= five %>
3
+ other is <%= three %>
4
+ EOF
5
+
6
+ require 'delegate'
7
+ require 'forwardable'
8
+ class Scope < SimpleDelegator
9
+ end
10
+
11
+ require 'erb'
12
+ class ShoppingList
13
+ def five
14
+ 'FiVe'
15
+ end
16
+
17
+ def initialize
18
+ renderer = ERB.new(TEMPLATE)
19
+ puts '***'
20
+
21
+ values = {one: 'One', three: 'tHrEe'}
22
+
23
+ scope = (Class.new(SimpleDelegator) do
24
+ extend Forwardable
25
+ def_delegators values, :one, :three
26
+
27
+ def three
28
+ 3
29
+ end
30
+ end).new(self)
31
+
32
+ puts renderer.result(scope.get_binding)
33
+ end
34
+
35
+ def get_binding
36
+ binding
37
+ end
38
+ end
39
+
40
+ puts '?'
41
+ test = ShoppingList.new
@@ -25,6 +25,15 @@ class DockerfileGenerator < Rails::Generators::Base
25
25
  class_option :mysql, type: :boolean, default: false,
26
26
  desc: 'include mysql libraries'
27
27
 
28
+ class_option :jemalloc, type: :boolean, default: false,
29
+ desc: 'use jemalloc alternative malloc implementation'
30
+
31
+ class_option :fullstaq, type: :boolean, default: false,
32
+ descr: 'use Fullstaq Ruby image from Quay.io'
33
+
34
+ class_option :yjit, type: :boolean, default: false,
35
+ desc: 'enable YJIT optimizing compiler'
36
+
28
37
  def generate_app
29
38
  source_paths.push File.expand_path('./templates', __dir__)
30
39
 
@@ -1,7 +1,7 @@
1
1
  # syntax = docker/dockerfile:1
2
2
 
3
3
  # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
4
- ARG RUBY_VERSION=<%= Gem.ruby_version %>
4
+ ARG RUBY_VERSION=<%= RUBY_VERSION %>
5
5
  <% if api_client_dir -%>
6
6
  ARG NODE_VERSION=<%= node_version %>
7
7
 
@@ -35,7 +35,11 @@ RUN npm run build
35
35
 
36
36
 
37
37
  <% end -%>
38
+ <% if options.fullstaq -%>
39
+ FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-<%= @options.jemalloc ? 'jemalloc-' : '' %>slim as base
40
+ <% else -%>
38
41
  FROM ruby:$RUBY_VERSION-slim as base
42
+ <% end -%>
39
43
 
40
44
  # Rails app lives here
41
45
  WORKDIR /rails
@@ -169,7 +173,10 @@ COPY --from=client /rails/<%= api_client_dir %>/build /rails/public
169
173
 
170
174
  # Deployment options
171
175
  ENV RAILS_LOG_TO_STDOUT="1" \
172
- RAILS_SERVE_STATIC_FILES="true"
176
+ RAILS_SERVE_STATIC_FILES="true"<% if options.yjit %> \
177
+ RUBY_YJIT_ENABLE="1"<% end %><% if options.jemalloc and not options.fullstaq %> \
178
+ LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" \
179
+ MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true"<% end %>
173
180
 
174
181
  # Entrypoint prepares the database.
175
182
  ENTRYPOINT ["/rails/bin/docker-entrypoint"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerfile-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
@@ -36,6 +36,7 @@ files:
36
36
  - Rakefile
37
37
  - lib/dockerfile-rails.rb
38
38
  - lib/dockerfile-rails/scanner.rb
39
+ - lib/erbtest.rb
39
40
  - lib/generators/dockerfile_generator.rb
40
41
  - lib/generators/templates/Dockerfile.erb
41
42
  - lib/generators/templates/docker-compose.yml.erb