dockerfile-rails 1.6.5 → 1.6.7

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: 908d7d4babef398cd7948ad8cd175c8634901fc45b2129d01e595e25c5014e17
4
- data.tar.gz: 30b27e3cdeda25023e9e277ae547c9896106f60b5f8668342a607d01a267d534
3
+ metadata.gz: c190ebed537c8bceba2405b670d2fc65b189e0d702112b39deec6cea801ebf23
4
+ data.tar.gz: 4d52c7dc5a0f6d764a1abb426318bb1f8ebbfa4225c28d6577d4ceac4f298fa6
5
5
  SHA512:
6
- metadata.gz: 3036363bbfa20b4aebe5271da76111dc6044419c6d20a7182b5b3bdbf6b5b445671007054909d8848bbb24836d93f6b1aa804ecb65ea18e30e0fb250f856197b
7
- data.tar.gz: aebe29d196c28a1fdc07d6e5ebd958cef15d65a258d417f02354b34744d9d46f6d641533639789cb55141e050ad0a6150840ecb59d15bc70d7bfb0d9f0f2e5a2
6
+ metadata.gz: ca197bd8b0262b8525102c55b9f8454931d388162059f8d4007e87ae27f85df453b40e47c76e88f438bb39da566faa02608cb87b6d3c6bd9dd9c4c08529c2f46
7
+ data.tar.gz: 48aa82c2ec5c8e6687260ce991899fe0f1faab8e914f78f88ed024ffa0a94c3a5d4b32340f5670c8d3deddc37b1d562f959e77118e7988aab65a8475bc2bdfb0
data/README.md CHANGED
@@ -51,6 +51,7 @@ different contents. If both are specified, `--force` takes precedence.
51
51
  * `--compose` - generate a `docker-compose.yml` file
52
52
  * `--max-idle=n` - exit afer *n* seconds of inactivity. Supports [iso 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) and [sleep](https://man7.org/linux/man-pages/man1/sleep.1.html#DESCRIPTION) syntaxes. Uses passenger for now, awaiting [puma](https://github.com/puma/puma/issues/2580) support.
53
53
  * `--nginx` - serve static files via [nginx](https://www.nginx.com/). May require `--root` on some targets to access `/dev/stdout`
54
+ * `--thruster` - serve static files via [thruster](https://github.com/basecamp/thruster?tab=readme-ov-file#thruster).
54
55
  * `--no-link` - don't add [--link](https://docs.docker.com/engine/reference/builder/#copy---link) to COPY statements. Some tools (like at the moment, [buildah](https://www.redhat.com/en/topics/containers/what-is-buildah)) don't yet support this feature.
55
56
  * `--no-lock` - don't add linux platforms, set `BUNDLE_DEPLOY`, or `--frozen-lockfile`. May be needed at times to work around a [rubygems bug](https://github.com/rubygems/rubygems/issues/6082#issuecomment-1329756343).
56
57
  * `--sudo` - install and configure sudo to enable `sudo -iu rails` access to full environment
@@ -40,6 +40,7 @@ class DockerfileGenerator < Rails::Generators::Base
40
40
  "sentry" => false,
41
41
  "sudo" => false,
42
42
  "swap" => nil,
43
+ "thruster" => false,
43
44
  "variant" => nil,
44
45
  "windows" => false,
45
46
  "yjit" => false,
@@ -185,6 +186,9 @@ class DockerfileGenerator < Rails::Generators::Base
185
186
  class_option :label, type: :hash, default: {},
186
187
  desc: "Add Docker label(s)"
187
188
 
189
+ class_option :thruster, type: :boolean, default: OPTION_DEFAULTS.thruster,
190
+ desc: "use Thruster HTTP/2 proxy"
191
+
188
192
  class_option :nginx, type: :boolean, default: OPTION_DEFAULTS.nginx,
189
193
  desc: "Serve static files with nginx"
190
194
 
@@ -507,6 +511,10 @@ private
507
511
  system "bundle add sentry-rails --skip-install" unless @gemfile.include? "sentry-rails"
508
512
  end
509
513
 
514
+ if options.thruster?
515
+ system "bundle add thruster --skip-install" unless @gemfile.include? "thruster"
516
+ end
517
+
510
518
  if options.rollbar?
511
519
  system "bundle add rollbar --skip-install" unless @gemfile.include? "rollbar"
512
520
  end
@@ -1126,6 +1134,10 @@ private
1126
1134
  nginx: '/usr/sbin/nginx -g "daemon off;"',
1127
1135
  rails: "./bin/rails server -p 3001"
1128
1136
  }
1137
+ elsif options.thruster? || @gemfile.include?("thruster")
1138
+ {
1139
+ rails: "bundle exec thrust ./bin/rails server"
1140
+ }
1129
1141
  else
1130
1142
  {
1131
1143
  rails: "./bin/rails server"
@@ -1162,6 +1174,12 @@ private
1162
1174
  more += "\n" + lines.join
1163
1175
  end
1164
1176
 
1177
+ # Ignore files uploaded using Shrine in development. This is the location used in their documentation.
1178
+ # https://shrinerb.com/docs/getting-started
1179
+ if @gemfile.include?("shrine")
1180
+ more += "\n/public/uploads/*\n"
1181
+ end
1182
+
1165
1183
  more
1166
1184
  end
1167
1185
 
@@ -1243,7 +1261,7 @@ private
1243
1261
  list.map { |name, cmd| " #{name} = #{cmd.inspect}" }.join("\n") + '\1')
1244
1262
  else
1245
1263
  toml += "\n[processes]\n" +
1246
- list.map { |name, cmd| " #{name} = #{cmd.inspect}\n" }.join
1264
+ list.map { |name, cmd| " #{name} = #{cmd.inspect}\n" }.join + "\n"
1247
1265
 
1248
1266
  app = list.has_key?("app") ? "app" : list.keys.first
1249
1267
 
@@ -1285,7 +1303,19 @@ private
1285
1303
 
1286
1304
  if match
1287
1305
  size = ((match[1].to_i * (suffixes[match[2]] || 1)) / 1048576.0).round
1288
- toml += "swap_size_mb = #{size}"
1306
+ if toml.include? "swap_size_mb"
1307
+ toml.sub!(/swap_size_mb.*/, "swap_size_mb = #{size}")
1308
+ else
1309
+ toml += "swap_size_mb = #{size}\n\n"
1310
+ end
1311
+ end
1312
+ end
1313
+
1314
+ # Add statics if not already present and not using a web server and workdir doesn't contain a variable
1315
+ unless options.nginx? || using_passenger? || options.thruster? || @gemfile.include?("thruster")
1316
+ workdir = (IO.read "Dockerfile" rescue "").scan(/^\s*WORKDIR\s+(\S+)/).flatten.last
1317
+ unless workdir && !workdir.include?("$") && toml.include?("[statics]")
1318
+ toml += "[[statics]]\n guest_path = \"#{workdir}/public\"\n url_prefix = \"/\"\n\n"
1289
1319
  end
1290
1320
  end
1291
1321
 
@@ -31,7 +31,7 @@ ARG <%= base_args.map {|key, value| "#{key}=#{value.inspect}"}.join(" \\\n ")
31
31
  ENV <%= base_env.join(" \\\n ") %>
32
32
 
33
33
  # Update gems and bundler
34
- RUN gem update --system --no-document && \
34
+ RUN gem update --system <% if RUBY_VERSION.start_with? '2' %>3.4.22 <% end %>--no-document && \
35
35
  gem install -N <%= base_gems.join(" ") %>
36
36
 
37
37
  <% unless base_packages.empty? -%>
@@ -181,7 +181,7 @@ FROM base
181
181
  <% end -%>
182
182
  <% if using_litefs? -%>
183
183
  # Install, configure litefs
184
- COPY --from=flyio/litefs:0.4.0 /usr/local/bin/litefs /usr/local/bin/litefs
184
+ COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs
185
185
  COPY<% if options.link? %> --link<% end %> config/litefs.yml /etc/litefs.yml
186
186
 
187
187
  <% 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.5
4
+ version: 1.6.7
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-02-03 00:00:00.000000000 Z
11
+ date: 2024-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails