dockerfile-rails 1.5.12 → 1.5.14

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: fdf6d8e58eec7c4d0eec797792faa410c9b0c09a7cfc478563e0f387166be802
4
- data.tar.gz: e238089dfc97a18fb6809be291ffbdc08d65e58b21be427fb5f3d3c7db5986bf
3
+ metadata.gz: 0fe17ee50b4f27de006bd75e0c810a0dcc0340676c79888729039e2bce7394d3
4
+ data.tar.gz: 135cf712dcd44282a8255460288045078450fe809dd24413aa510eb2a5505a69
5
5
  SHA512:
6
- metadata.gz: 7e7b085fb960accab2838308541e3a85eb08f3a069d486dc48e644f42d06d6ffb2d8f240ab2abf9df87dc10f82b2881ea5f93f264f9c192f3e32895bda7754d4
7
- data.tar.gz: 94d2d844c5af3382f81c8956148878564ad1dc6ca5ff636d75c67ef031e18c4276ec980e729883ab0220474e30fc69565a319c592a83dda21387365d7aba121b
6
+ metadata.gz: 152a64e964d12c90dd9f723cfcc5a22f8676eca1aed835de5f829fb851b67075521115eeb24d5f72f4ec2482954a4bc3739c5f9f0b3594a167bf05af65f3da80
7
+ data.tar.gz: 76579f910905786f5b1c38320f3efce47accebd5d3e829a16e6cec5aa3a32ac609a3b9c4137f66f4d299ed3b32c4acda9643db32f1ac0825b187c501bea1cfdf
data/README.md CHANGED
@@ -22,7 +22,7 @@ bundle add dockerfile-rails --optimistic --group development
22
22
  bin/rails generate dockerfile
23
23
  ```
24
24
 
25
- The `--optomistic` flag will make sure you always get the latest `dockerfile-rails` gem when you run `bundle update && rails g dockerfile`.
25
+ The `--optimistic` flag will make sure you always get the latest `dockerfile-rails` gem when you run `bundle update && rails g dockerfile`.
26
26
 
27
27
  ### General option:
28
28
 
@@ -880,8 +880,9 @@ private
880
880
  end
881
881
 
882
882
  def binfile_fixups
883
+ binfiles = Dir["bin/*"].select { |f| File.file?(f) }
883
884
  # binfiles may have OS specific paths to ruby. Normalize them.
884
- shebangs = Dir["bin/*"].map do |file|
885
+ shebangs = binfiles.map do |file|
885
886
  IO.read(file).lines.first.encode("UTF-8", "binary", invalid: :replace, undef: :replace, replace: "")
886
887
  end.join
887
888
  rubies = shebangs.scan(%r{#!/usr/bin/env (ruby.*)}).flatten.uniq
@@ -896,14 +897,14 @@ private
896
897
  # line endings. This avoids adding unnecessary fixups if
897
898
  # none are required, but prepares for the need to do the
898
899
  # fix line endings if other fixups are required.
899
- has_cr = Dir["bin/*"].any? { |file| IO.read(file).include? "\r" }
900
+ has_cr = binfiles.any? { |file| IO.read(file).include? "\r" }
900
901
  if has_cr || (Gem.win_platform? && !binfixups.empty?) || options.windows?
901
902
  binfixups.unshift 'sed -i "s/\r$//g" bin/*'
902
903
  end
903
904
 
904
905
  # Windows file systems may not have the concept of executable.
905
906
  # In such cases, fix up during the build.
906
- if Dir["bin/*"].any? { |file| !File.executable?(file) } || options.windows?
907
+ if binfiles.any? { |file| !File.executable?(file) } || options.windows?
907
908
  binfixups.unshift "chmod +x bin/*"
908
909
  end
909
910
 
@@ -1115,6 +1116,8 @@ private
1115
1116
  return path if File.executable? path
1116
1117
  end
1117
1118
  end
1119
+
1120
+ nil
1118
1121
  end).call
1119
1122
  return unless flyctl
1120
1123
 
@@ -222,27 +222,30 @@ RUN mkdir /data
222
222
  <% else -%>
223
223
  # Run and own only the runtime files as a non-root user for security
224
224
  <% if options.compose? -%>
225
+ <% user = "rails:rails" -%>
225
226
  ARG UID=1000 \
226
227
  GID=1000
227
228
  RUN groupadd -f -g $GID rails && \
228
229
  useradd -u $UID -g $GID rails --create-home --shell /bin/bash && \
229
230
  <% else -%>
230
- RUN useradd rails --create-home --shell /bin/bash && \
231
+ <% user = "1000:1000" -%>
232
+ RUN groupadd --system --gid 1000 rails && \
233
+ useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
231
234
  <% end -%>
232
235
  <% if options.nginx? -%>
233
- chown rails:rails /var/lib/nginx /var/log/nginx/* && \
236
+ chown <%= user %> /var/lib/nginx /var/log/nginx/* && \
234
237
  <% end -%>
235
238
  <% if deploy_packages.include?("sudo") && options.sudo? -%>
236
239
  sed -i 's/env_reset/env_keep="*"/' /etc/sudoers && \
237
240
  <% end -%>
238
241
  <% if deploy_database == 'sqlite3' -%>
239
242
  mkdir /data<% if using_litefs? %> /litefs<% end %> && \
240
- chown -R rails:rails <%= Dir[*%w(db log storage tmp)].join(" ") %> /data<% if using_litefs? %> /litefs<% end %>
243
+ chown -R <%= user %> <%= Dir[*%w(db log storage tmp)].join(" ") %> /data<% if using_litefs? %> /litefs<% end %>
241
244
  <% else -%>
242
- chown -R rails:rails <%= Dir[*%w(db log storage tmp)].join(" ") %>
245
+ chown -R <%= user %> <%= Dir[*%w(db log storage tmp)].join(" ") %>
243
246
  <% end -%>
244
247
  <% unless options.swap? or using_passenger? or using_litefs? -%>
245
- USER rails:rails
248
+ USER <%= user %>
246
249
  <% end -%>
247
250
 
248
251
  <% end -%>
@@ -8,7 +8,7 @@ RUN <% if options.cache? %>--mount=type=cache,id=bld-bun-cache,target=/root/.bun
8
8
  <% end %>bun install<% if options.lock? %> --frozen-lockfile<% end %>
9
9
  <% elsif sources.join.include? 'yarn' -%>
10
10
  RUN <% if options.cache? %>--mount=type=cache,id=bld-yarn-cache,target=/root/.yarn \
11
- YARN_CACHE_FOLDER=/root/.yarn <% end %>yarn install<% if options.lock? %> --frozen-lockfile<% end %>
11
+ YARN_CACHE_FOLDER=/root/.yarn <% end %>yarn install<% if options.lock? %> --<% if yarn_version < '2' -%>frozen-lockfile<% else %>immutable<% end %><% end %>
12
12
  <% else -%>
13
13
  RUN <% if options.cache? %>--mount=type=cache,id=bld-npm-cache,target=/root/.npm \
14
14
  <% end %>npm install
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.5.12
4
+ version: 1.5.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Ruby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-24 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.4.8
77
+ rubygems_version: 3.4.10
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Dockerfile generator for Rails