dockerfile-rails 1.2.5 → 1.3.0
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 +4 -4
- data/DEMO.md +1 -1
- data/README.md +8 -1
- data/Rakefile +1 -1
- data/lib/generators/dockerfile_generator.rb +83 -12
- data/lib/generators/templates/Dockerfile.erb +28 -19
- data/lib/generators/templates/_passenger.erb +28 -0
- data/lib/generators/templates/docker-entrypoint.erb +3 -3
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8780a8a7015d339452edf4dff330981a748ad72c72081e0cfa473c835121637c
|
4
|
+
data.tar.gz: ab37e68fe9d3f82f9368e45738a12f171eaaabcff8b311451d89bdbce1217d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1bce2d42a5916ae7bf4cc49f23d0b9077533e1447015f35bfd4835397438a8bb4bc13e48a774a7e80130cf0f99dada597fda1fa0cada1674e52073d7846fc1
|
7
|
+
data.tar.gz: 9793fdc06ffe7a84a1e0f40282570ea5e4ad6e08514ff8210f805254a093208cc4b98f683c44fce299dc0b71ff04c2418b847c5e33f05da407cefd617412521b
|
data/DEMO.md
CHANGED
@@ -132,7 +132,7 @@ docker compose up
|
|
132
132
|
# Demo 4 - API only
|
133
133
|
|
134
134
|
This demo deploys a [Create React App](https://create-react-app.dev/) client and a Rails API-only server. Ruby and Rails version information is retrieved from the server and displayed below a spinning React logo. Note that the build process installs the
|
135
|
-
node
|
135
|
+
node modules and ruby gems in parallel.
|
136
136
|
|
137
137
|
```bash
|
138
138
|
rails new demo --api
|
data/README.md
CHANGED
@@ -40,6 +40,7 @@ bin/rails generate dockerfile
|
|
40
40
|
|
41
41
|
* `--ci` - include test gems in deployed image
|
42
42
|
* `--compose` - generate a `docker-compose.yml` file
|
43
|
+
* `--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.
|
43
44
|
* `--nginx` - serve static files via [nginx](https://www.nginx.com/). May require `--root` on some targets to access `/dev/stdout`
|
44
45
|
* `--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.
|
45
46
|
* `--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).
|
@@ -65,16 +66,18 @@ Not all of your needs can be determined by scanning your application. For examp
|
|
65
66
|
* `--env=name:value` - add an environment variable
|
66
67
|
* `--remove package...` - remove package from "to be added" list
|
67
68
|
|
68
|
-
Each of these can be tailored to a specific build phase by adding `-base`, `-build`, or `-deploy` after the flag name (e.g `--
|
69
|
+
Each of these can be tailored to a specific build phase by adding `-base`, `-build`, or `-deploy` after the flag name (e.g `--add-build freetds-dev --add-deploy freetds-bin`). If no such suffix is found, the default for arg is `-base`, and the default for the rest is `-deploy`. Removal of an arg or environment variable is done by leaving the value blank (e.g `--env-build=PORT:`).
|
69
70
|
|
70
71
|
### Configuration:
|
71
72
|
|
72
73
|
* `--bin-cd` - adjust binstubs to set current working directory
|
74
|
+
[autocrlf](https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_autocrlf) enabled or may not be able to set bin stubs as executable.
|
73
75
|
* `--label=name:value` - specify docker label. Can be used multiple times. See [LABEL](https://docs.docker.com/engine/reference/builder/#label) for detail
|
74
76
|
* `--no-prepare` - omit `db:prepare`. Useful for cloud platforms with [release](https://devcenter.heroku.com/articles/release-phase) phases
|
75
77
|
* `--platform=s` - specify target platform. See [FROM](https://docs.docker.com/engine/reference/builder/#from) for details
|
76
78
|
* `--precompile=defer` - may be needed when your configuration requires access to secrets that are not available at build time. Results in larger images and slower deployments.
|
77
79
|
* `--root` - run application as root
|
80
|
+
* `--windows` - make Dockerfile work for Windows users that may have set `git config --global core.autocrlf true`
|
78
81
|
|
79
82
|
Options are saved between runs into `config/dockerfile.yml`. To invert a boolean options, add or remove a `no-` prefix from the option name.
|
80
83
|
|
@@ -118,3 +121,7 @@ The following links relate to the current development status with respect to Rai
|
|
118
121
|
* Fly.io [Cut over to Rails Dockerfile Generator on Sunday 29 Jan 2023](https://community.fly.io/t/cut-over-to-rails-dockerfile-generator-on-sunday-29-jan-2023/10350)
|
119
122
|
* Fly.io [FAQ](https://fly.io/docs/rails/getting-started/dockerfiles/)
|
120
123
|
* DDH's [target](https://github.com/rails/rails/pull/47372#issuecomment-1438971730)
|
124
|
+
|
125
|
+
Parallel efforts for Hanami:
|
126
|
+
|
127
|
+
* [Proposal](https://discourse.hanamirb.org/t/dockerfile-hanami/816)
|
data/Rakefile
CHANGED
@@ -16,9 +16,11 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
16
16
|
"label" => {},
|
17
17
|
"link" => true,
|
18
18
|
"lock" => true,
|
19
|
+
"max-idle" => nil,
|
19
20
|
"mysql" => false,
|
20
21
|
"nginx" => false,
|
21
22
|
"parallel" => false,
|
23
|
+
"passenger" => false,
|
22
24
|
"platform" => nil,
|
23
25
|
"postgresql" => false,
|
24
26
|
"precompile" => nil,
|
@@ -28,6 +30,7 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
28
30
|
"sqlite3" => false,
|
29
31
|
"sudo" => false,
|
30
32
|
"swap" => nil,
|
33
|
+
"windows" => false,
|
31
34
|
"yjit" => false,
|
32
35
|
}.then { |hash| Struct.new(*hash.keys.map(&:to_sym)).new(*hash.values) }
|
33
36
|
|
@@ -84,6 +87,9 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
84
87
|
class_option "bin-cd", type: :boolean, default: OPTION_DEFAULTS["bin-cd"],
|
85
88
|
desc: "modify binstubs to set working directory"
|
86
89
|
|
90
|
+
class_option "windows", type: :boolean, default: OPTION_DEFAULTS["windows"],
|
91
|
+
desc: "fixup CRLF in binstubs and make each executable"
|
92
|
+
|
87
93
|
class_option :cache, type: :boolean, default: OPTION_DEFAULTS.cache,
|
88
94
|
desc: "use build cache to speed up installs"
|
89
95
|
|
@@ -129,6 +135,12 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
129
135
|
class_option :nginx, type: :boolean, default: OPTION_DEFAULTS.nginx,
|
130
136
|
desc: "Serve static files with nginx"
|
131
137
|
|
138
|
+
class_option :passenger, type: :boolean, default: OPTION_DEFAULTS.passenger,
|
139
|
+
desc: "Serve Rails application with Phusion Passsenger"
|
140
|
+
|
141
|
+
class_option "max-idle", type: :string, default: OPTION_DEFAULTS["max-idle"],
|
142
|
+
desc: "Exit server after application has been idle for n seconds."
|
143
|
+
|
132
144
|
class_option :root, type: :boolean, default: OPTION_DEFAULTS.root,
|
133
145
|
desc: "Run application as root user"
|
134
146
|
|
@@ -290,6 +302,17 @@ private
|
|
290
302
|
end
|
291
303
|
|
292
304
|
def using_redis?
|
305
|
+
# Note: If you have redis installed on your computer, 'rails new` will
|
306
|
+
# automatically add redis to your Gemfile, so having it in your Gemfile is
|
307
|
+
# not a reliable indicator of whether or not your application actually uses
|
308
|
+
# redis.
|
309
|
+
|
310
|
+
# using_redis? is currently used for two things: actually adding the redis
|
311
|
+
# gem if it is going to be needed in production, and adding a redis
|
312
|
+
# container to docker-compose.yml. Neither of these actions should be done
|
313
|
+
# unless there is an indication that redis is actually being used and not
|
314
|
+
# merely included in the Gemfile.
|
315
|
+
|
293
316
|
options.redis? or @redis or @gemfile.include?("sidekiq")
|
294
317
|
end
|
295
318
|
|
@@ -301,6 +324,10 @@ private
|
|
301
324
|
@gemfile.include?("grover") or @gemfile.include?("puppeteer-ruby")
|
302
325
|
end
|
303
326
|
|
327
|
+
def using_passenger?
|
328
|
+
options.passenger? or options["max-idle"]
|
329
|
+
end
|
330
|
+
|
304
331
|
def using_sidekiq?
|
305
332
|
@gemfile.include?("sidekiq")
|
306
333
|
end
|
@@ -369,7 +396,9 @@ private
|
|
369
396
|
gems = ["bundler"]
|
370
397
|
|
371
398
|
if options.ci? && options.lock? && @gemfile.include?("debug")
|
372
|
-
|
399
|
+
# https://github.com/rails/rails/pull/47515
|
400
|
+
# https://github.com/rubygems/rubygems/issues/6082#issuecomment-1329756343
|
401
|
+
gems += %w(irb reline) - @gemfile unless Gem.ruby_version >= "3.2.2"
|
373
402
|
end
|
374
403
|
|
375
404
|
gems.sort
|
@@ -391,7 +420,6 @@ private
|
|
391
420
|
# libicu63 in buster, libicu67 in bullseye, libiclu72 in bookworm...
|
392
421
|
packages << "libicu-dev" if @gemfile.include? "charlock_holmes"
|
393
422
|
|
394
|
-
|
395
423
|
if @gemfile.include? "webp-ffi"
|
396
424
|
# https://github.com/le0pard/webp-ffi#requirements
|
397
425
|
packages += %w(libjpeg-dev libpng-dev libtiff-dev libwebp-dev)
|
@@ -464,7 +492,8 @@ private
|
|
464
492
|
# start with databases: sqlite3, postgres, mysql
|
465
493
|
packages << "libsqlite3-0" if options.sqlite3? || @sqlite3
|
466
494
|
packages << "postgresql-client" if options.postgresql? || @postgresql
|
467
|
-
packages << "default-mysql-client" if options.mysql || @mysql
|
495
|
+
packages << "default-mysql-client" if options.mysql? || @mysql
|
496
|
+
packages << "libjemalloc2" if options.jemalloc? && !options.fullstaq?
|
468
497
|
|
469
498
|
# ActiveStorage preview support
|
470
499
|
packages << "libvips" if @gemfile.include? "ruby-vips"
|
@@ -483,8 +512,11 @@ private
|
|
483
512
|
end
|
484
513
|
end
|
485
514
|
|
515
|
+
# Passenger
|
516
|
+
packages += %w(passenger libnginx-mod-http-passenger) if using_passenger?
|
517
|
+
|
486
518
|
# nginx
|
487
|
-
packages << "nginx" if options.nginx?
|
519
|
+
packages << "nginx" if options.nginx? || using_passenger?
|
488
520
|
|
489
521
|
# sudo
|
490
522
|
packages << "sudo" if options.sudo?
|
@@ -494,18 +526,35 @@ private
|
|
494
526
|
|
495
527
|
def deploy_repos
|
496
528
|
repos = []
|
529
|
+
packages = []
|
497
530
|
|
498
531
|
if using_puppeteer? && deploy_packages.include?("google-chrome-stable")
|
532
|
+
packages += %w(gnupg curl)
|
499
533
|
repos += [
|
500
|
-
"curl https://
|
501
|
-
"gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg &&",
|
534
|
+
"curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt |",
|
535
|
+
" gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg &&",
|
502
536
|
'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
503
537
|
]
|
504
538
|
end
|
505
539
|
|
540
|
+
if using_passenger?
|
541
|
+
packages += %w(gnupg curl)
|
542
|
+
repos += [
|
543
|
+
"curl https://oss-binaries.phusionpassenger.com/auto-software-signing-gpg-key.txt |",
|
544
|
+
" gpg --dearmor > /etc/apt/trusted.gpg.d/phusion.gpg &&",
|
545
|
+
"bash -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger $(source /etc/os-release; echo $VERSION_CODENAME) main > /etc/apt/sources.list.d/passenger.list'"
|
546
|
+
]
|
547
|
+
end
|
548
|
+
|
506
549
|
if repos.empty?
|
507
550
|
""
|
508
551
|
else
|
552
|
+
packages.sort!.uniq!
|
553
|
+
unless packages.empty?
|
554
|
+
repos.unshift "apt-get update -qq &&",
|
555
|
+
"apt-get install --no-install-recommends -y #{packages.join(" ")} &&"
|
556
|
+
end
|
557
|
+
|
509
558
|
repos.join(" \\\n ") + " && \\\n "
|
510
559
|
end
|
511
560
|
end
|
@@ -552,7 +601,7 @@ private
|
|
552
601
|
def deploy_env
|
553
602
|
env = {}
|
554
603
|
|
555
|
-
env["PORT"] = "3001" if options.nginx?
|
604
|
+
env["PORT"] = "3001" if options.nginx? && !using_passenger?
|
556
605
|
|
557
606
|
if Rails::VERSION::MAJOR < 7 || Rails::VERSION::STRING.start_with?("7.0")
|
558
607
|
env["RAILS_LOG_TO_STDOUT"] = "1"
|
@@ -563,7 +612,7 @@ private
|
|
563
612
|
env["RUBY_YJIT_ENABLE"] = "1"
|
564
613
|
end
|
565
614
|
|
566
|
-
if options.jemalloc? &&
|
615
|
+
if options.jemalloc? && !options.fullstaq?
|
567
616
|
if (options.platform || Gem::Platform.local.cpu).include? "arm"
|
568
617
|
env["LD_PRELOAD"] = "/usr/lib/aarch64-linux-gnu/libjemalloc.so.2"
|
569
618
|
else
|
@@ -648,13 +697,13 @@ private
|
|
648
697
|
# none are required, but prepares for the need to do the
|
649
698
|
# fix line endings if other fixups are required.
|
650
699
|
has_cr = Dir["bin/*"].any? { |file| IO.read(file).include? "\r" }
|
651
|
-
if has_cr || (Gem.win_platform? && !binfixups.empty?)
|
700
|
+
if has_cr || (Gem.win_platform? && !binfixups.empty?) || options.windows?
|
652
701
|
binfixups.unshift 'sed -i "s/\r$//g" bin/*'
|
653
702
|
end
|
654
703
|
|
655
704
|
# Windows file systems may not have the concept of executable.
|
656
705
|
# In such cases, fix up during the build.
|
657
|
-
|
706
|
+
if Dir["bin/*"].any? { |file| !File.executable?(file) } || options.windows?
|
658
707
|
binfixups.unshift "chmod +x bin/*"
|
659
708
|
end
|
660
709
|
|
@@ -669,7 +718,7 @@ private
|
|
669
718
|
def deploy_database
|
670
719
|
if options.postgresql? || @postgresql
|
671
720
|
"postgresql"
|
672
|
-
elsif options.mysql || @mysql
|
721
|
+
elsif options.mysql? || @mysql
|
673
722
|
"mysql"
|
674
723
|
else
|
675
724
|
"sqlite3"
|
@@ -758,7 +807,11 @@ private
|
|
758
807
|
end
|
759
808
|
|
760
809
|
def procfile
|
761
|
-
if
|
810
|
+
if using_passenger?
|
811
|
+
{
|
812
|
+
nginx: "nginx"
|
813
|
+
}
|
814
|
+
elsif options.nginx?
|
762
815
|
{
|
763
816
|
nginx: '/usr/sbin/nginx -g "daemon off;"',
|
764
817
|
rails: "./bin/rails server -p 3001"
|
@@ -782,4 +835,22 @@ private
|
|
782
835
|
|
783
836
|
more
|
784
837
|
end
|
838
|
+
|
839
|
+
def max_idle
|
840
|
+
option = options["max-idle"]
|
841
|
+
|
842
|
+
if option == nil || option.strip.downcase == "infinity"
|
843
|
+
nil
|
844
|
+
elsif /^\s*\d+(\.\d+)\s*/.match? option
|
845
|
+
option.to_f
|
846
|
+
elsif /^\s*P/.match? option
|
847
|
+
ActiveSupport::Duration.parse(option.strip).seconds
|
848
|
+
else
|
849
|
+
option.scan(/\d+\w/).map do |t|
|
850
|
+
ActiveSupport::Duration.parse("PT#{t.upcase}") rescue ActiveSupport::Duration.parse("P#{t.upcase}")
|
851
|
+
end.sum.seconds
|
852
|
+
end
|
853
|
+
rescue ArgumentError
|
854
|
+
nil
|
855
|
+
end
|
785
856
|
end
|
@@ -145,37 +145,46 @@ ARG <%= deploy_args.map {|key, value| "#{key}=#{value.inspect}"}.join(" \\\n
|
|
145
145
|
<%= render partial: 'apt_install', locals: {packages: deploy_packages, clean: true, repos: deploy_repos} %>
|
146
146
|
<% end -%>
|
147
147
|
|
148
|
-
<% if
|
148
|
+
<% if using_passenger? -%>
|
149
|
+
<%= render partial: 'passenger' %>
|
150
|
+
|
151
|
+
<% elsif options.nginx? -%>
|
149
152
|
<%= render partial: 'nginx' %>
|
150
153
|
|
151
154
|
<% elsif procfile.size > 1 -%>
|
152
155
|
RUN gem install foreman
|
153
156
|
|
157
|
+
<% end -%>
|
158
|
+
<% unless options.precompile == "defer" -%>
|
159
|
+
# Copy built artifacts: gems, application
|
160
|
+
COPY --from=build /usr/local/bundle /usr/local/bundle
|
161
|
+
COPY --from=build /rails /rails
|
162
|
+
<% if api_client_dir -%>
|
163
|
+
|
164
|
+
# Copy built client
|
165
|
+
COPY --from=client /rails/<%= api_client_dir %>/build /rails/public
|
166
|
+
<% end -%>
|
167
|
+
|
154
168
|
<% end -%>
|
155
169
|
<% unless run_as_root? -%>
|
156
|
-
# Run and own the
|
170
|
+
# Run and own only the runtime files as a non-root user for security
|
157
171
|
<% if options.compose? -%>
|
158
172
|
ARG UID=1000 \
|
159
173
|
GID=1000
|
160
174
|
RUN groupadd -f -g $GID rails && \
|
161
|
-
useradd -u $UID -g $GID rails
|
162
|
-
|
163
|
-
|
164
|
-
sed -i 's/env_reset/env_keep="*"/' /etc/sudoers && \
|
165
|
-
chown rails:rails .<% end %>
|
166
|
-
<% unless options.swap -%>
|
167
|
-
USER rails:rails
|
175
|
+
useradd -u $UID -g $GID rails --create-home --shell /bin/bash && \
|
176
|
+
<% else -%>
|
177
|
+
RUN useradd rails --create-home --shell /bin/bash && \
|
168
178
|
<% end -%>
|
169
|
-
|
179
|
+
<% if options.nginx? -%>
|
180
|
+
chown rails:rails /var/lib/nginx /var/log/nginx/* && \
|
170
181
|
<% end -%>
|
171
|
-
<%
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
<%
|
176
|
-
|
177
|
-
# Copy built client
|
178
|
-
COPY --from=client <% unless run_as_root? %>--chown=rails:rails <% end %>/rails/<%= api_client_dir %>/build /rails/public
|
182
|
+
<% if deploy_packages.include?("sudo") && options.sudo? -%>
|
183
|
+
sed -i 's/env_reset/env_keep="*"/' /etc/sudoers && \
|
184
|
+
<% end -%>
|
185
|
+
chown -R rails:rails <%= Dir[*%w(db log storage tmp)].join(" ") %>
|
186
|
+
<% unless options.swap? or using_passenger? -%>
|
187
|
+
USER rails:rails
|
179
188
|
<% end -%>
|
180
189
|
|
181
190
|
<% end -%>
|
@@ -205,5 +214,5 @@ CMD ["foreman", "start", "--procfile=Procfile.prod"]
|
|
205
214
|
<% else -%>
|
206
215
|
# Start the server by default, this can be overwritten at runtime
|
207
216
|
EXPOSE 3000
|
208
|
-
CMD
|
217
|
+
CMD <%= procfile.values.first.split(" ").inspect %>
|
209
218
|
<% end -%>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# configure nginx and passenger
|
2
|
+
COPY <<-'EOF' /etc/nginx/sites-enabled/default
|
3
|
+
server {
|
4
|
+
listen 3000;
|
5
|
+
root /rails/public;
|
6
|
+
passenger_enabled on;
|
7
|
+
<% if options['max-idle'] -%>
|
8
|
+
passenger_ctl hook_detached_process /etc/nginx/hook_detached_process;
|
9
|
+
passenger_min_instances 0;
|
10
|
+
passenger_pool_idle_time <%= max_idle %>;
|
11
|
+
<% end -%>
|
12
|
+
}
|
13
|
+
<% if options['max-idle'] -%>
|
14
|
+
COPY <<-'EOF' /etc/nginx/sites-enabled/hook_detached_process
|
15
|
+
#!/usr/bin/env ruby
|
16
|
+
status = `passenger-status`
|
17
|
+
processes = status[/^Processes\s*:\s*(\d*)/, 1].to_i
|
18
|
+
system 'nginx -s stop' if processes == 0
|
19
|
+
EOF
|
20
|
+
<% end -%>
|
21
|
+
EOF
|
22
|
+
RUN echo "daemon off;" >> /etc/nginx/nginx.conf && \
|
23
|
+
sed -i 's/access_log\s.*;/access_log \/dev\/stdout;/' /etc/nginx/nginx.conf && \
|
24
|
+
sed -i 's/error_log\s.*;/error_log \/dev\/stderr info;/' /etc/nginx/nginx.conf && \
|
25
|
+
<% if options['max-idle'] -%>
|
26
|
+
chmod +sx /etc/nginx/sites-enabled/hook_detached_process && \
|
27
|
+
<% end -%>
|
28
|
+
mkdir /var/run/passenger-instreg
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/bin/bash -e
|
2
2
|
|
3
3
|
<% if options.swap -%>
|
4
|
-
<% if run_as_root? -%>
|
4
|
+
<% if run_as_root? or using_passenger? -%>
|
5
5
|
<% @space = "" -%>
|
6
6
|
<% else -%>
|
7
7
|
<% @space = " " -%>
|
@@ -14,7 +14,7 @@ if [ $UID -eq 0 ]; then
|
|
14
14
|
<%= @space %>echo 10 > /proc/sys/vm/swappiness
|
15
15
|
<%= @space %>swapon /swapfile
|
16
16
|
<%= @space %>echo 1 > /proc/sys/vm/overcommit_memory
|
17
|
-
<% unless run_as_root? -%>
|
17
|
+
<% unless run_as_root? or using_passenger? -%>
|
18
18
|
exec su rails $0 $@
|
19
19
|
fi
|
20
20
|
<% end -%>
|
@@ -26,7 +26,7 @@ fi
|
|
26
26
|
if [ "${*}" == "foreman start --procfile=Procfile.prod" ]; then
|
27
27
|
<% else -%>
|
28
28
|
# If running the rails server then create or migrate existing database
|
29
|
-
if [ "${*}" ==
|
29
|
+
if [ "${*}" == <%= procfile.values.first.inspect %> ]; then
|
30
30
|
<% end -%>
|
31
31
|
<% if options.precompile == "defer" -%>
|
32
32
|
./bin/rails assets:precompile
|
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.
|
4
|
+
version: 1.3.0
|
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-
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,6 +44,7 @@ files:
|
|
44
44
|
- lib/generators/templates/_nginx.erb
|
45
45
|
- lib/generators/templates/_node_client.erb
|
46
46
|
- lib/generators/templates/_npm_install.erb
|
47
|
+
- lib/generators/templates/_passenger.erb
|
47
48
|
- lib/generators/templates/docker-compose.yml.erb
|
48
49
|
- lib/generators/templates/docker-entrypoint.erb
|
49
50
|
- lib/generators/templates/dockerfile.yml.erb
|
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
70
|
- !ruby/object:Gem::Version
|
70
71
|
version: '0'
|
71
72
|
requirements: []
|
72
|
-
rubygems_version: 3.4.
|
73
|
+
rubygems_version: 3.4.8
|
73
74
|
signing_key:
|
74
75
|
specification_version: 4
|
75
76
|
summary: Dockerfile generator for Rails
|