dockerfile-rails 1.6.6 → 1.6.7

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: ff714b723bfd0a501b2ebef7946a4d00877233cf1912d5092c7ff92d57b938ae
4
- data.tar.gz: 5ba04178d0f287466a58c8bc496583faa6f01812c58086819ec8d8e37c8190fb
3
+ metadata.gz: c190ebed537c8bceba2405b670d2fc65b189e0d702112b39deec6cea801ebf23
4
+ data.tar.gz: 4d52c7dc5a0f6d764a1abb426318bb1f8ebbfa4225c28d6577d4ceac4f298fa6
5
5
  SHA512:
6
- metadata.gz: 17cc361096d9afdb32917d80701af6904395160e1e4715f4b41bdfbe707bb51c1c074d0f5b1cc3f8fbdeed6ac2ca90702721d844ed65ede457144eab820b863d
7
- data.tar.gz: b2af2f207fa347f4b90a9fe09cfe7466702ffdce144e40d1f618049be00ab64fdf577b067111635ee46593d6bd1e5aacd80061770e950846a3c426b8bb5fbdef
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"
@@ -1249,7 +1261,7 @@ private
1249
1261
  list.map { |name, cmd| " #{name} = #{cmd.inspect}" }.join("\n") + '\1')
1250
1262
  else
1251
1263
  toml += "\n[processes]\n" +
1252
- list.map { |name, cmd| " #{name} = #{cmd.inspect}\n" }.join
1264
+ list.map { |name, cmd| " #{name} = #{cmd.inspect}\n" }.join + "\n"
1253
1265
 
1254
1266
  app = list.has_key?("app") ? "app" : list.keys.first
1255
1267
 
@@ -1291,7 +1303,19 @@ private
1291
1303
 
1292
1304
  if match
1293
1305
  size = ((match[1].to_i * (suffixes[match[2]] || 1)) / 1048576.0).round
1294
- 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"
1295
1319
  end
1296
1320
  end
1297
1321
 
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.6
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-03-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