dockerfile-rails 1.6.7 → 1.6.9

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: c190ebed537c8bceba2405b670d2fc65b189e0d702112b39deec6cea801ebf23
4
- data.tar.gz: 4d52c7dc5a0f6d764a1abb426318bb1f8ebbfa4225c28d6577d4ceac4f298fa6
3
+ metadata.gz: 8273f4e7e16fa5763ebfee285648dfede6ec020e51d51e3e9b8caf5b70333aba
4
+ data.tar.gz: 16824fb5f76c53dcf5fb0ebca40335591def91034e9cdfea59d12f0b44fb1fed
5
5
  SHA512:
6
- metadata.gz: ca197bd8b0262b8525102c55b9f8454931d388162059f8d4007e87ae27f85df453b40e47c76e88f438bb39da566faa02608cb87b6d3c6bd9dd9c4c08529c2f46
7
- data.tar.gz: 48aa82c2ec5c8e6687260ce991899fe0f1faab8e914f78f88ed024ffa0a94c3a5d4b32340f5670c8d3deddc37b1d562f959e77118e7988aab65a8475bc2bdfb0
6
+ metadata.gz: 682c85b4a0a4d5e7157e39bb300b17ec4eff7be7beb98a6431b74d36d7e4f0dfa3d9b3bb81bfe5d31852423fc750595366ca503b9a44ac05a83acb5187afe1c1
7
+ data.tar.gz: c015796534771823bf606a22165d76899dd21745ac580d6bcc0b8aa780ef0ddf1427818536120616bf91eb3ea686838cf5f42b718b5d36804db6f59b3abc2a58
data/README.md CHANGED
@@ -34,7 +34,7 @@ different contents. If both are specified, `--force` takes precedence.
34
34
 
35
35
  ### Runtime Optimizations:
36
36
 
37
- * `--alpine` - use [alpine](https://www.alpinelinux.org/) as base image
37
+ * `--alpine` - use [alpine](https://www.alpinelinux.org/) as base image (requires [Alpine <= 3.18 OR Rails >= 8.0](https://github.com/sparklemotion/sqlite3-ruby/issues/434))
38
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)
39
39
  * `--jemalloc` - use [jemalloc](https://jemalloc.net/) memory allocator
40
40
  * `--swap=n` - allocate swap space. See [falloc options](https://man7.org/linux/man-pages/man1/fallocate.1.html#OPTIONS) for suffixes
@@ -128,7 +128,9 @@ Running all integration tests, or even a single individual test can be done as f
128
128
 
129
129
  ```
130
130
  rake test
131
- ruby test/test_minimal.rb
131
+
132
+ bundle exec rake test TEST=test/test_minimal.rb
133
+ bundle exec ruby test/test_minimal.rb
132
134
  ```
133
135
 
134
136
  To assist with this process, outputs of tests can be captured automatically. This is useful when adding new tests and when making a change that affects many tests. Be sure to inspect the output (e.g., by using `git diff`) before committing.
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ namespace :test do
30
30
  sh "bundle config set --local local.dockerfile-rails #{__dir__}"
31
31
  sh "bundle add dockerfile-rails --group development " +
32
32
  "--git https://github.com/rubys/dockerfile-rails.git"
33
- sh "bin/rails generate dockerfile"
33
+ sh "bin/rails generate dockerfile --force"
34
34
  cp "#{__dir__}/test/docker-entrypoint", "bin"
35
35
  IO.write "config/routes.rb",
36
36
  'Rails.application.routes.draw {get "/up", to: proc {[200, {}, ["ok"]]}}'
@@ -45,13 +45,13 @@ namespace :test do
45
45
  task :alpine do
46
46
  rm_rf "test/tmp/system_test"
47
47
  Dir.chdir "test/tmp" do
48
- sh "rails new system_test --javascript esbuild"
48
+ sh "rails new system_test --javascript esbuild --main"
49
49
  Dir.chdir "system_test"
50
50
  sh "bundle config disable_local_branch_check true"
51
51
  sh "bundle config set --local local.dockerfile-rails #{__dir__}"
52
52
  sh "bundle add dockerfile-rails --group development " +
53
53
  "--git https://github.com/rubys/dockerfile-rails.git"
54
- sh "bin/rails generate dockerfile --alpine"
54
+ sh "bin/rails generate dockerfile --alpine --force"
55
55
  cp "#{__dir__}/test/docker-entrypoint", "bin"
56
56
  IO.write "config/routes.rb",
57
57
  'Rails.application.routes.draw {get "/up", to: proc {[200, {}, ["ok"]]}}'
@@ -1034,6 +1034,8 @@ private
1034
1034
  end
1035
1035
 
1036
1036
  def node_version
1037
+ return unless using_node? || using_execjs?
1038
+
1037
1039
  version = nil
1038
1040
 
1039
1041
  if File.exist? ".node-version"
@@ -87,16 +87,10 @@ ENV <%= build_env.join(" \\\n ") %>
87
87
  <% end -%>
88
88
  # Install application gems
89
89
  COPY<% if options.link? %> --link<% end %> Gemfile Gemfile.lock <% if references_ruby_version_file? %>.ruby-version <% end %>./
90
- <% if options.alpine? and deploy_packages.include? 'sqlite-libs' -%>
91
- # Workaround sqlite/alpine issue: https://github.com/sparklemotion/sqlite3-ruby/issues/434
92
- RUN bundle config force_ruby_platform true && \
93
- bundle config set frozen false && \
94
- bundle lock --add-platform ruby
95
- <% end -%>
96
90
  <% if options.cache? -%>
97
91
  RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \
98
92
  <% if private_gemserver_env_variable_name -%>
99
- --mount=type=secret,id=gemserver_credentials,dst=/kaniko/gemserver_credentials \
93
+ --mount=type=secret,id=gemserver_credentials,target=/kaniko/gemserver_credentials \
100
94
  <%= private_gemserver_env_variable_name %>="$(cat /kaniko/gemserver_credentials)" && \
101
95
  export <%= private_gemserver_env_variable_name %> && \
102
96
  <% end -%>
@@ -113,7 +107,7 @@ RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \
113
107
 
114
108
  <% else -%>
115
109
  <% if private_gemserver_env_variable_name -%>
116
- RUN --mount=type=secret,id=gemserver_credentials,dst=/kaniko/gemserver_credentials \
110
+ RUN --mount=type=secret,id=gemserver_credentials,target=/kaniko/gemserver_credentials \
117
111
  <%= private_gemserver_env_variable_name %>="$(cat /kaniko/gemserver_credentials)" && \
118
112
  export <%= private_gemserver_env_variable_name %> && \
119
113
  bundle install<% if depend_on_bootsnap? && options.precompile != "defer" -%> && \
@@ -286,7 +280,11 @@ ENV <%= deploy_env.join(" \\\n ") %>
286
280
  <% else -%>
287
281
  # Entrypoint sets up the container.
288
282
  <% end -%>
283
+ <% if using_litefs? -%>
284
+ ENTRYPOINT ["litefs", "mount"]
285
+ <% else -%>
289
286
  ENTRYPOINT ["/rails/bin/docker-entrypoint"]
287
+ <% end -%>
290
288
 
291
289
  <% if procfile.size > 1 -%>
292
290
  # Build a Procfile for production use
@@ -307,7 +305,7 @@ VOLUME /data
307
305
  CMD ["foreman", "start", "--procfile=<%= options.procfile %>"]
308
306
  <% elsif procfile.size > 1 -%>
309
307
  CMD ["foreman", "start", "--procfile=Procfile.prod"]
310
- <% else -%>
308
+ <% elsif !using_litefs? -%>
311
309
  CMD <%= procfile.values.first.split(" ").inspect %>
312
310
  <% end -%>
313
311
  <% end -%>
@@ -98,6 +98,10 @@ services:
98
98
  command: bundle exec sidekiq
99
99
  <% else -%>
100
100
  command: bundle exec rake solid_queue:start
101
+ <% end -%>
102
+ <% if private_gemserver_env_variable_name -%>
103
+ secrets:
104
+ - gemserver_credentials
101
105
  <% end -%>
102
106
  environment:
103
107
  - RAILS_MASTER_KEY=$RAILS_MASTER_KEY
@@ -77,6 +77,8 @@ proxy:
77
77
  # "static" which assigns a single node to be the primary and does
78
78
  # not failover.
79
79
  lease:
80
+ promote: true
81
+
80
82
  # Required. Must be either "consul" or "static".
81
83
  type: "consul"
82
84
 
@@ -114,3 +116,19 @@ lease:
114
116
  # can become leader. This buffer is intended to prevent
115
117
  # overlap in leadership due to clock skew or in-flight calls.
116
118
  lock-delay: "1s"
119
+
120
+ exec:
121
+ # Only run migrations on candidate nodes.
122
+ - cmd: "./bin/rails db:prepare"
123
+ if-candidate: true
124
+
125
+ # Then run the application server on all nodes.
126
+ <% if !options.procfile.blank? -%>
127
+ - cmd: "foreman start --procfile=<%= options.procfile %>"
128
+ <% elsif procfile.size > 1 -%>
129
+ - cmd: "foreman start --procfile=Procfile.prod"
130
+ <% elsif !using_litefs? -%>
131
+ - cmd: <%= procfile.values.first.split(" ").inspect %>
132
+ <% else -%>
133
+ - cmd: "./bin/rails server"
134
+ <% end -%>
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: 1.6.7
4
+ version: 1.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-17 00:00:00.000000000 Z
11
+ date: 2024-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails