dockerfile-rails 1.5.7 → 1.5.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: 72398e19c6ec602cb3ee07308355ee88cb742f99b0fc5662f9853577d9821da0
4
- data.tar.gz: ffe47ec3fd02742f6616624bbccc44396bd0e0857628dd016d5e702251c59c60
3
+ metadata.gz: aa278e91ec05725efb320caaecd9ca2cde617166b4ad4157f7103eeccecf4961
4
+ data.tar.gz: 748f841c1ba25cfa9f126c056a97e6eb9f6e854ea937f0e7c3a93756992746ed
5
5
  SHA512:
6
- metadata.gz: 14eecd6bd9cb250dc156beb8520c57879d51531b5c5174d9b361d48a3dc2ca6e754062546b15201d8e67b7e851c62e5ef5d1efcd18f535e35acc0e164a87a307
7
- data.tar.gz: ea07ff6cfcb76487cd07038e82895dfcf99ed7eec998e378046950a8406456b2de590f265186eb09c7f783f7cc1b60673a15ef4373a1920a1dca6234a1033b9b
6
+ metadata.gz: 6af2d5008690de608fb72d114c59a3a4a56ff7348be8d4a3c8f21243e3a5e002bd53341297ccaece8191c9e53312b080af973e382dc62b698bb0f7e4832cb188
7
+ data.tar.gz: c87bbb4eee23e9a5c2dc63d297308edc16df2baf42ea68640df6edca33537ed2acd195a0b49438b6d857c26a8812ad0c19809b8e129d0645e80f6e604a3d0553
@@ -387,6 +387,11 @@ private
387
387
  @using_node = File.exist? "package.json"
388
388
  end
389
389
 
390
+ def using_bun?
391
+ return @using_bun if @using_bun != nil
392
+ @using_bun = File.exist?("bun.config.js") || File.exist?("bun.lockb")
393
+ end
394
+
390
395
  def using_redis?
391
396
  # Note: If you have redis installed on your computer, 'rails new` will
392
397
  # automatically add redis to your Gemfile, so having it in your Gemfile is
@@ -501,7 +506,7 @@ private
501
506
  if options.ci? && options.lock? && @gemfile.include?("debug")
502
507
  # https://github.com/rails/rails/pull/47515
503
508
  # https://github.com/rubygems/rubygems/issues/6082#issuecomment-1329756343
504
- gems += %w(irb reline) - @gemfile unless Gem.ruby_version >= "3.2.2"
509
+ gems += %w(irb reline) - @gemfile unless Gem.ruby_version >= Gem::Version.new("3.2.2")
505
510
  end
506
511
 
507
512
  gems.sort
@@ -572,7 +577,11 @@ private
572
577
  # node support, including support for building native modules
573
578
  if using_node?
574
579
  packages += %w(node-gyp pkg-config)
575
- packages += %w(curl) unless using_execjs? || using_puppeteer?
580
+
581
+ unless using_execjs? || using_puppeteer?
582
+ packages << "curl"
583
+ packages << "unzip" if using_bun?
584
+ end
576
585
 
577
586
  # module build process depends on Python, and debian changed
578
587
  # how python is installed with the bullseye release. Below
@@ -954,6 +963,14 @@ private
954
963
  "latest"
955
964
  end
956
965
 
966
+
967
+ def bun_version
968
+ version = `bun --version`[/\d+\.\d+\.\d+/] rescue nil
969
+ version ||= `npm show bun version`[/\d+\.\d+\.\d+/] rescue nil
970
+
971
+ version
972
+ end
973
+
957
974
  def depend_on_bootsnap?
958
975
  @gemfile.include? "bootsnap"
959
976
  end
@@ -982,7 +999,7 @@ private
982
999
  client = api_client_dir
983
1000
  return unless client
984
1001
 
985
- Dir["#{client}/{package.json,package-lock.json,yarn.lock}"]
1002
+ Dir["#{client}/{package.json,package-lock.json,yarn.lock,bun.lockb}"]
986
1003
  end
987
1004
 
988
1005
  def dbprep_command
@@ -58,15 +58,18 @@ FROM base as <%= parallel? ? 'pre' : '' %>build
58
58
 
59
59
  <% if parallel? -%>
60
60
 
61
- FROM prebuild as node
61
+ FROM prebuild as <% if using_bun? %>bun<% else %>node<% end %>
62
62
 
63
63
  <% end -%>
64
- <% if using_node? and (!using_execjs? || File.exist?('yarn.lock')) -%>
64
+ <% if using_bun? and (!using_execjs? || File.exist?('bun.lockb')) -%>
65
+ <%= render partial: 'install_node', locals: {bun_version: using_execjs? ? nil : bun_version} %>
66
+
67
+ <% elsif using_node? and (!using_execjs? || File.exist?('yarn.lock')) -%>
65
68
  <%= render partial: 'install_node', locals: {node_version: using_execjs? ? nil : node_version, yarn_version: File.exist?('yarn.lock') ? yarn_version : nil} %>
66
69
 
67
70
  <% end -%>
68
71
  <% if parallel? -%>
69
- <%= render partial: 'npm_install', locals: {sources: %w(package.json yarn.lock)} %>
72
+ <%= render partial: 'npm_install', locals: {sources: Dir[*%w(package.json yarn.lock bun.lockb)]} %>
70
73
 
71
74
 
72
75
  FROM prebuild as build
@@ -122,13 +125,20 @@ RUN passenger-config build-native-support
122
125
 
123
126
  <% end -%>
124
127
  <% if parallel? -%>
128
+ <% if using_bun? -%>
129
+ # Copy bun modules
130
+ COPY --from=bun /rails/node_modules /rails/node_modules
131
+ COPY --from=bun /usr/local/bun /usr/local/bun
132
+ ENV PATH=/usr/local/bun/bin:$PATH
133
+ <% else -%>
125
134
  # Copy node modules
126
135
  COPY --from=node /rails/node_modules /rails/node_modules
127
136
  COPY --from=node /usr/local/node /usr/local/node
128
137
  ENV PATH=/usr/local/node/bin:$PATH
138
+ <% end -%>
129
139
 
130
140
  <% elsif using_node? -%>
131
- <%= render partial: 'npm_install', locals: {sources: Dir[*%w(.npmrc .yarnrc package.json package-lock.json yarn.lock)]} %>
141
+ <%= render partial: 'npm_install', locals: {sources: Dir[*%w(.npmrc .yarnrc package.json package-lock.json yarn.lock bun.lockb)]} %>
132
142
 
133
143
  <% end -%>
134
144
  # Copy application code
@@ -1,3 +1,12 @@
1
+ <% if using_bun? -%>
2
+ # Install Bun
3
+ <% if bun_version -%>
4
+ ARG BUN_VERSION=<%= bun_version %>
5
+ <% end -%>
6
+ ENV BUN_INSTALL=/usr/local/bun
7
+ ENV PATH=/usr/local/bun/bin:$PATH
8
+ RUN curl -fsSL https://bun.sh/install | bash<% if bun_version %> -s -- "bun-v${BUN_VERSION}"<% end %>
9
+ <% else -%>
1
10
  <% if node_version and yarn_version -%>
2
11
  # Install JavaScript dependencies
3
12
  <% elsif node_version -%>
@@ -31,3 +40,4 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
31
40
  <% if node_version -%>
32
41
  rm -rf /tmp/node-build-master
33
42
  <% end -%>
43
+ <% end -%>
@@ -3,14 +3,13 @@ COPY<% if options.link? %> --link<% end %> <%= sources.join(' ') %> ./
3
3
  <% if sources.join.include?('.yarnrc') && !Dir['.yarn/releases/*'].empty? -%>
4
4
  COPY<% if options.link? %> --link<% end %> .yarn/releases/* .yarn/releases/
5
5
  <% end -%>
6
- <% if sources.join.include? 'yarn' -%>
7
- RUN <% if options.cache? -%>--mount=type=cache,id=bld-yarn-cache,target=/root/.yarn \
8
- YARN_CACHE_FOLDER=/root/.yarn <% end -%>yarn install<% if options.lock? %> --frozen-lockfile<% end %>
6
+ <% if using_bun? -%>
7
+ RUN <% if options.cache? %>--mount=type=cache,id=bld-bun-cache,target=/root/.bun \
8
+ <% end %>bun install<% if options.lock? %> --frozen-lockfile<% end %>
9
+ <% elsif sources.join.include? 'yarn' -%>
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 %>
9
12
  <% else -%>
10
- <% if options.cache? -%>
11
- RUN --mount=type=cache,id=bld-npm-cache,target=/root/.npm \
12
- npm install
13
- <% else -%>
14
- RUN npm install
15
- <% end -%>
13
+ RUN <% if options.cache? %>--mount=type=cache,id=bld-npm-cache,target=/root/.npm \
14
+ <% end %>npm install
16
15
  <% 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.5.7
4
+ version: 1.5.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: 2023-09-11 00:00:00.000000000 Z
11
+ date: 2023-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails