dockerfile-rails 1.5.8 → 1.5.10

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: c5e9c1e8d960ae456906f2936d6153ded39849a02208fa11a05ca4b8bc0d543e
4
- data.tar.gz: 950ef36696d78e571d9a762235194009fedbf98f3f1809aa3a6740d7fb8aa507
3
+ metadata.gz: d88f0410567f5185fcffce4a01b85cd5d63d04864e261ded85f260389b1bbf35
4
+ data.tar.gz: 3f2d42a85d4b78401842aed0c78f277ae5d6c97fe8aa76a370a420d407b8ad5c
5
5
  SHA512:
6
- metadata.gz: 66806af153d826188e9e3d7e582f683f66b4cae76b8d0307db0dbc1e9d3d839aa6037ccf578d8a9aa894d2dd18dd42549d23adcacde544e0000a09f58ef3cd22
7
- data.tar.gz: 8589fe07b31ca9064c8b6b9d9a839efb78f36f512a00dc3e589bf1a18cbd5605b63e15933d1eb844168501a4283624c160b45f2dea068f06283317fdef731b11
6
+ metadata.gz: cf0c9e328c292f8e9f4cab6e5529ae0767837b0339cbd673809cd23aa6a884ff3fd7562e1a0d85fbe9711fb9925e60f1c3ecb9bf9f7b4ff9d6ad652dcab1b9d3
7
+ data.tar.gz: 9c1886019e9b95c8190beb66b82f65338f959b210ecced923aa819ec7843f903a849a8022b1429f92c6f0ab5ec20a0e62ef2e6bd05e1627e1e1cb3d79149afba
data/README.md CHANGED
@@ -23,6 +23,10 @@ bin/rails generate dockerfile
23
23
  ### General option:
24
24
 
25
25
  * `--force` - overwrite existing files
26
+ * `--skip` - keep existing files
27
+
28
+ If neither are specified, you will be prompted if a file exists with
29
+ different contents. If both are specified, `--force` takes precedence.
26
30
 
27
31
  ### Runtime Optimizations:
28
32
 
@@ -61,6 +65,7 @@ additional support may be needed:
61
65
  * `--postgresql` - add postgresql libraries
62
66
  * `--redis` - add redis libraries
63
67
  * `--sqlite3` - add sqlite3 libraries
68
+ * `--sqlserver` - add SQL Server libraries
64
69
 
65
70
  ### Add a package/environment variable/build argument:
66
71
 
@@ -53,6 +53,7 @@ module DockerfileRails
53
53
  @sqlite3 = true if @gemfile.include? "sqlite3"
54
54
  @postgresql = true if @gemfile.include? "pg"
55
55
  @mysql = true if @gemfile.include?("mysql2") || using_trilogy?
56
+ @sqlserver = true if @gemfile.include?("activerecord-sqlserver-adapter")
56
57
 
57
58
  ### node modules ###
58
59
 
@@ -35,6 +35,7 @@ class DockerfileGenerator < Rails::Generators::Base
35
35
  "rollbar" => false,
36
36
  "root" => false,
37
37
  "sqlite3" => false,
38
+ "sqlserver" => false,
38
39
  "sentry" => false,
39
40
  "sudo" => false,
40
41
  "swap" => nil,
@@ -127,6 +128,9 @@ class DockerfileGenerator < Rails::Generators::Base
127
128
  class_option :sqlite3, aliases: "--sqlite", type: :boolean, default: OPTION_DEFAULTS.sqlite3,
128
129
  desc: "include sqlite3 libraries"
129
130
 
131
+ class_option :sqlserver, aliases: "--sqlserver", type: :boolean, default: OPTION_DEFAULTS.sqlserver,
132
+ desc: "include SQL server libraries"
133
+
130
134
  class_option :litefs, type: :boolean, default: OPTION_DEFAULTS.litefs,
131
135
  desc: "replicate sqlite3 databases using litefs"
132
136
 
@@ -294,7 +298,7 @@ class DockerfileGenerator < Rails::Generators::Base
294
298
  fly_attach_consul
295
299
  end
296
300
 
297
- if File.exist?("fly.toml") && (fly_processes || !options.prepare || options.swap)
301
+ if File.exist?("fly.toml") && (fly_processes || !options.prepare || options.swap || deploy_database == "sqlite3")
298
302
  if File.stat("fly.toml").size > 0
299
303
  template "fly.toml.erb", "fly.toml"
300
304
  else
@@ -560,6 +564,7 @@ private
560
564
  # add databases: sqlite3, postgres, mysql
561
565
  packages << "pkg-config" if options.sqlite3? || @sqlite3
562
566
  packages << "libpq-dev" if options.postgresql? || @postgresql
567
+ packages << "freetds-dev" if options.sqlserver? || @sqlserver
563
568
 
564
569
  if (options.mysql? || @mysql) && !using_trilogy?
565
570
  packages << "default-libmysqlclient-dev"
@@ -577,7 +582,11 @@ private
577
582
  # node support, including support for building native modules
578
583
  if using_node?
579
584
  packages += %w(node-gyp pkg-config)
580
- packages += %w(curl) unless using_execjs? || using_puppeteer?
585
+
586
+ unless using_execjs? || using_puppeteer?
587
+ packages << "curl"
588
+ packages << "unzip" if using_bun?
589
+ end
581
590
 
582
591
  # module build process depends on Python, and debian changed
583
592
  # how python is installed with the bullseye release. Below
@@ -611,6 +620,7 @@ private
611
620
  # start with databases: sqlite3, postgres, mysql
612
621
  packages << "postgresql-client" if options.postgresql? || @postgresql
613
622
  packages << "default-mysql-client" if options.mysql? || @mysql
623
+ packages << "freetds-bin" if options.sqlserver? || @sqlserver
614
624
  packages << "libjemalloc2" if options.jemalloc? && !options.fullstaq?
615
625
  if options.sqlite3? || @sqlite3
616
626
  packages << "libsqlite3-0" unless packages.include? "sqlite3"
@@ -912,6 +922,8 @@ private
912
922
  "postgresql"
913
923
  elsif options.mysql? || @mysql || has_mysql_gem?
914
924
  "mysql"
925
+ elsif options.sqlserver || @sqlserver
926
+ "sqlserver"
915
927
  else
916
928
  "sqlite3"
917
929
  end
@@ -961,8 +973,8 @@ private
961
973
 
962
974
 
963
975
  def bun_version
964
- version = `bun --version`[/\d+\.\d+\.\d+/]
965
- version ||= `npm show bun version`[/\d+\.\d+\.\d+/]
976
+ version = `bun --version`[/\d+\.\d+\.\d+/] rescue nil
977
+ version ||= `npm show bun version`[/\d+\.\d+\.\d+/] rescue nil
966
978
 
967
979
  version
968
980
  end
@@ -1143,6 +1155,12 @@ private
1143
1155
  end
1144
1156
  end
1145
1157
 
1158
+ if deploy_database == "sqlite3"
1159
+ if not toml.include? "[mounts]"
1160
+ toml += "[mounts]\n source=\"data\"\n destination=\"/data\"\n\n"
1161
+ end
1162
+ end
1163
+
1146
1164
  if options.swap
1147
1165
  suffixes = {
1148
1166
  "kib" => 1024,
@@ -34,8 +34,8 @@ ENV <%= base_env.join(" \\\n ") %>
34
34
  RUN gem update --system --no-document && \
35
35
  gem install -N <%= base_gems.join(" ") %>
36
36
 
37
- <% unless base_requirements.empty? -%>
38
- # Install packages needed to install <%= base_requirements %>
37
+ <% unless base_packages.empty? -%>
38
+ # Install packages<% unless base_requirements.empty? -%> needed to install <%= base_requirements %><% end %>
39
39
  <%= render partial: 'apt_install', locals: {packages: base_packages, clean: true, repos: base_repos} %>
40
40
 
41
41
  <% end -%>
@@ -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,10 +125,17 @@ 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
141
  <%= render partial: 'npm_install', locals: {sources: Dir[*%w(.npmrc .yarnrc package.json package-lock.json yarn.lock bun.lockb)]} %>
@@ -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 -%>
@@ -8,23 +17,14 @@
8
17
  <% if node_version && node_version != 'lts' -%>
9
18
  ARG NODE_VERSION=<%= node_version %>
10
19
  <% end -%>
11
- <% if using_bun? -%>
12
- <% if bun_version -%>
13
- ARG BUN_VERSION=<%= bun_version %>
14
- <% end -%>
15
- <% else -%>
16
20
  <% if yarn_version -%>
17
21
  ARG YARN_VERSION=<%= yarn_version %>
18
22
  <% end -%>
19
- <% end -%>
20
23
  <% if node_version && node_version != 'lts' -%>
21
24
  ENV PATH=/usr/local/node/bin:$PATH
22
25
  RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
23
26
  /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
24
27
  <% end -%>
25
- <% if using_bun? -%>
26
- npm install -g bun<% if bun_version %>@$BUN_VERSION<% end %> && \
27
- <% else -%>
28
28
  <% if yarn_version -%>
29
29
  <% if yarn_version < '2' -%>
30
30
  <% if node_version -%> <% else %>RUN<% end %> npm install -g yarn@$YARN_VERSION<% if node_version -%> && \<% end %>
@@ -37,7 +37,7 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
37
37
  corepack prepare yarn@$YARN_VERSION --activate<% if node_version -%> && \<% end %>
38
38
  <% end -%>
39
39
  <% end -%>
40
- <% end -%>
41
40
  <% if node_version -%>
42
41
  rm -rf /tmp/node-build-master
43
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 -%><% if using_bun? %>bun<% else %>yarn<% end %> 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.8
4
+ version: 1.5.10
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-14 00:00:00.000000000 Z
11
+ date: 2023-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 3.0.0
27
27
  description:
28
28
  email: rubys@intertwingly.net
29
29
  executables: []