dockerfile-rails 0.4.7 → 0.4.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: f7578107905d7265d79a480e52c9a960e58d5b5cde92e6a3c6de22e3a7c2b269
4
- data.tar.gz: 8a1a483463c405746298d425a259838d18a1128231aac5e0c68733be607f1e7b
3
+ metadata.gz: 92c7394bd97da528362105514f095458b56872645ce0c3082c748c7bee22c54f
4
+ data.tar.gz: e7a158e41126aa6321e5b4461951b6323f7fa950f8eef8eb366ee436454c0057
5
5
  SHA512:
6
- metadata.gz: 7d459f7291d6588b1f1b6353f27bde783f018f1f7dd16d80dc4f643cb8ec5a3934c5cc1d96eaabd857a7c0cb43a947917cdaf44b4e064e24397bfc2a8876f1cc
7
- data.tar.gz: 0f4b1859a1b07a8f7b6e7e3679a7a3566a1957148f708d66be5be0ec2e2ead03706a4f7d30ac964a216e7912d0896bcf2e83612534a9c841780454c73c726b78
6
+ metadata.gz: 35619e605b9ed5176157c841efb21f4cfec9029c6383732d440bd9a440144719c8cc62e43974124148d5dbc1fb2705bd0160d4581f6829aa8ccdeb0040b665bb
7
+ data.tar.gz: 94b595caa9b67e1d814b863f535eae373dca80a5b14d410122a0b0199fdb46955ddb6d7609f3ce58945e9419047da6128864a751f8af36dbb2d8230bfd87f1d8
data/README.md CHANGED
@@ -17,6 +17,7 @@ General options:
17
17
 
18
18
  * `--force` - overwrite existing files
19
19
  * `--ci` - include test gems in deployed image
20
+ * `--bin-cd` - adjust binstubs to set current working directory
20
21
  * `--platform=s` - specify target platform. See [FROM](https://docs.docker.com/engine/reference/builder/#from) for details.
21
22
  * `--cache` - use build caching to speed up builds
22
23
  * `--parallel` - use multi-stage builds to install gems and node modules in parallel
@@ -55,9 +56,14 @@ To assis with this process, outputs of tests can be captured automatically. Thi
55
56
 
56
57
  ```
57
58
  rake test:capture
58
- TEST_CAPTURE=1 ruby test/test_minimal.rb
59
59
  ```
60
60
 
61
+ If you are running a single test, the following environment variables settings may be helpful:
62
+
63
+ * `RAILS_ENV=TEST` will match the environment used to produce the captured outputs.
64
+ * `TEST_CAPTURE=1` will capture test results.
65
+ * `TEST_KEEP=1` will leave the test app behind for inspection after the test completes.
66
+
61
67
  ## Links
62
68
 
63
69
  Many of the following links relate to the current development status with respect to Rails 7.1 and will be removed once that is resolved.
@@ -7,6 +7,9 @@ class DockerfileGenerator < Rails::Generators::Base
7
7
  class_option :ci, type: :boolean, default: false,
8
8
  desc: 'include test gems in bundle'
9
9
 
10
+ class_option 'bin-cd', type: :boolean, default: false,
11
+ desc: 'modify binstubs to set working directory'
12
+
10
13
  class_option :cache, type: :boolean, default: false,
11
14
  desc: 'use build cache to speed up installs'
12
15
 
@@ -210,6 +213,11 @@ private
210
213
  binfixups.unshift "chmod +x bin/*"
211
214
  end
212
215
 
216
+ # optionally, adjust cwd
217
+ if options['bin-cd']
218
+ binfixups.push %{sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*}
219
+ end
220
+
213
221
  binfixups
214
222
  end
215
223
 
@@ -19,7 +19,7 @@ WORKDIR /rails
19
19
  # Set production environment
20
20
  ENV RAILS_ENV="production" \
21
21
  BUNDLE_PATH="vendor/bundle" \
22
- BUNDLE_WITHOUT="<%= options.ci? ? 'test' : 'development:test' %>"
22
+ BUNDLE_WITHOUT="<%= options.ci? ? 'development' : 'development:test' %>"
23
23
 
24
24
  # Update gems and preinstall the desired version of bundler
25
25
  ARG BUNDLER_VERSION=<%= Bundler::VERSION %>
@@ -70,14 +70,16 @@ RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \
70
70
  mkdir -p vendor && \
71
71
  bundle config set path vendor && \
72
72
  cp -ar /srv/vendor .
73
+
73
74
  <% else -%>
74
75
  RUN bundle _${BUNDLER_VERSION}_ install<% if depend_on_bootsnap? -%> && \
75
- bundle exec bootsnap precompile --gemfile
76
- <% end -%>
77
- <% end -%>
76
+ bundle exec bootsnap precompile --gemfile<% end %>
78
77
 
78
+ <% end -%>
79
79
  <% if parallel? -%>
80
- asdf
80
+ # Copy node modules
81
+ COPY --from=node /rails/node_modules /rails/node_modules
82
+
81
83
  <% elsif using_node? -%>
82
84
  <%= render partial: 'npm_install', locals: {sources: %w(package.json yarn.lock)} %>
83
85
 
@@ -91,7 +93,11 @@ RUN bundle exec bootsnap precompile app/ lib/
91
93
 
92
94
  <% end -%>
93
95
  <% unless binfile_fixups.empty? -%>
94
- # Adjust binfiles to be executable on Linux
96
+ <% if options['bin-cd'] and binfile_fixups.length == 1 -%>
97
+ # Adjust binfiles to set current working directory
98
+ <% else -%>
99
+ # Adjust binfiles to be executable on Linux<%= options['bin-cd'] ? ' and set current working directory' : '' %>
100
+ <% end -%>
95
101
  <%= "RUN " + binfile_fixups.join(" && \\\n ") %>
96
102
 
97
103
  <% 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: 0.4.7
4
+ version: 0.4.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-01-22 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails