dockerfile-rails 1.0.1 → 1.0.2

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: 3cf90509af5087378fd186d88358f0157d40ca2335e19a66ecdddbf1efd9add4
4
- data.tar.gz: 640b5eeb291be5e4168a5da7ffd17236b1ebf49deed3fb8a5d8148e6fe3ba92c
3
+ metadata.gz: 0227d5ff2b7d0a0d42d48ba7e3be63280ea528f3f80417a6419dfebbec44b3a7
4
+ data.tar.gz: ee9b4b14b72b85193a6e7b54862f6643b02896c5ff4636b294a845e7ae6a1b35
5
5
  SHA512:
6
- metadata.gz: 9390f22b5e4348c6d59345b08c843bec8ae4932e6b20afa69bffac4bf600c3489ae093e9847b9f59cd0b688b448d35c4c5a1815743b2693abd90db97d051a7cd
7
- data.tar.gz: 77fe857b46a6aa3b5bda4d7b3ce0f68b24f1907d1a049c927b4e2d0e759d39b2fd771ebf3b5937d92c418f4d3e04b52f07788d939b06d644a0d4f028fb9bd7c2
6
+ metadata.gz: 2e9f99b443c3cab5dca0d5800eb996b7f727ef0dbfcf44ad0e1586edf1ed9691b3cafbf1c608f207a55c63fd9d768e2796c4d3644c3e6715214ca5aa159ae122
7
+ data.tar.gz: 6980319c05859df14c35649159c874271162ff83ac1c2918e4c959c93f6f39b29f5a4002cbf9305f82404ae8b5d00ee4d0e401e420c37a86abb6b0c8362adcf8
data/README.md CHANGED
@@ -10,7 +10,7 @@ Provides a Rails generator to produce Dockerfiles and related files. This is be
10
10
  ## Usage
11
11
 
12
12
  ```
13
- bundle add dockerfile-rails --version ">= 0.5.0" --group development
13
+ bundle add dockerfile-rails --optimistic --group development
14
14
  bin/rails generate dockerfile
15
15
  ```
16
16
 
@@ -40,9 +40,7 @@ module DockerfileRails
40
40
  end
41
41
  end
42
42
 
43
- @sidekiq = @gemfile.include? 'sidekiq'
44
43
  @anycable = @gemfile.include? 'anycable-rails'
45
- @rmagick = @gemfile.include? 'rmagick'
46
44
  @vips = @gemfile.include? 'ruby-vips'
47
45
  @bootstrap = @gemfile.include? 'bootstrap'
48
46
  @puppeteer = @gemfile.include? 'puppeteer'
@@ -73,7 +71,7 @@ module DockerfileRails
73
71
  @redis_cache = true
74
72
  end
75
73
 
76
- @redis = @redis_cable || @redis_cache || @sidekiq
74
+ @redis = @redis_cable || @redis_cache
77
75
  end
78
76
  end
79
77
  end
@@ -142,7 +142,7 @@ private
142
142
  end
143
143
 
144
144
  def using_redis?
145
- options.redis? or @redis
145
+ options.redis? or @redis or @gemfile.include?('sidekiq')
146
146
  end
147
147
 
148
148
  def using_execjs?
@@ -150,7 +150,11 @@ private
150
150
  end
151
151
 
152
152
  def using_puppeteer?
153
- @gemfile.include?('grover')
153
+ @gemfile.include?('grover') or @gemfile.include?('puppeteer-ruby')
154
+ end
155
+
156
+ def using_sidekiq?
157
+ @gemfile.include?('sidekiq')
154
158
  end
155
159
 
156
160
  def parallel?
@@ -176,6 +180,27 @@ private
176
180
  end
177
181
  end
178
182
 
183
+ def base_packages
184
+ packages = []
185
+
186
+ if using_execjs?
187
+ packages += %w(curl unzip)
188
+ end
189
+
190
+ if using_puppeteer?
191
+ packages += %w(curl gnupg)
192
+ end
193
+
194
+ packages.sort.uniq
195
+ end
196
+
197
+ def base_requirements
198
+ requirements = []
199
+ requirements << 'nodejs' if using_execjs?
200
+ requirements << 'chrome' if using_puppeteer?
201
+ requirements.join(' and ')
202
+ end
203
+
179
204
  def build_packages
180
205
  # start with the essentials
181
206
  packages = %w(build-essential)
@@ -188,7 +213,7 @@ private
188
213
  # add git if needed to install gems
189
214
  packages << 'git' if @git
190
215
 
191
- # add redis in case Action Cable, caching, or sidekiq are added later
216
+ # add redis if Action Cable, caching, or sidekiq are used
192
217
  packages << "redis" if options.redis? or using_redis?
193
218
 
194
219
  # ActiveStorage preview support
@@ -200,7 +225,7 @@ private
200
225
  # node support, including support for building native modules
201
226
  if using_node?
202
227
  packages += %w(node-gyp pkg-config)
203
- packages += %w(curl unzip) unless using_execjs?
228
+ packages += %w(curl unzip) unless using_execjs? or using_puppeteer?
204
229
 
205
230
  # module build process depends on Python, and debian changed
206
231
  # how python is installed with the bullseye release. Below
@@ -240,7 +265,9 @@ private
240
265
  packages << "libvips" if @gemfile.include? 'ruby-vips'
241
266
 
242
267
  # Rmagick gem
243
- packages << 'imagemagick' if @gemfile.include? 'rmagick'
268
+ if @gemfile.include?('rmagick') or @gemfile.include?('mini_magick')
269
+ packages << 'imagemagick'
270
+ end
244
271
 
245
272
  # Puppeteer
246
273
  packages << 'google-chrome-stable' if using_puppeteer?
@@ -26,15 +26,12 @@ ARG BUNDLER_VERSION=<%= Bundler::VERSION %>
26
26
  RUN gem update --system --no-document && \
27
27
  gem install -N bundler -v ${BUNDLER_VERSION}
28
28
 
29
- <% if using_execjs? -%>
30
- <% if using_puppeteer? -%>
31
- # Install packages needed to install nodejs and chrome
32
- <%= render partial: 'apt_install', locals: {packages: %w(curl gnupg unzip), clean: true, repos: ''} %>
33
- <% else -%>
34
- # Install packages needed to install nodejs
35
- <%= render partial: 'apt_install', locals: {packages: %w(curl unzip), clean: true, repos: ''} %>
36
- <% end -%>
29
+ <% unless base_requirements.empty? -%>
30
+ # Install packages needed to install <%= base_requirements %>
31
+ <%= render partial: 'apt_install', locals: {packages: base_packages, clean: true, repos: ''} %>
37
32
 
33
+ <% end -%>
34
+ <% if using_execjs? -%>
38
35
  <%= render partial: 'install_node', locals: {yarn_version: nil} %>
39
36
 
40
37
  <% end -%>
@@ -68,4 +68,27 @@ services:
68
68
 
69
69
  redis-db:
70
70
  image: redis
71
+ <% end -%>
72
+ <% if using_sidekiq? and deploy_database != 'sqlite3' -%>
73
+
74
+ sidekiq:
75
+ build: .
76
+ environment:
77
+ - RAILS_MASTER_KEY=$RAILS_MASTER_KEY
78
+ - REDIS_URL=redis://redis-db:6379
79
+ <% if deploy_database == 'postgresql' -%>
80
+ - DATABASE_URL=postgres://root:password@postgres-db/
81
+ <% elsif deploy_database == 'mysql' -%>
82
+ - DATABASE_URL=mysql2://root:password@mysql-db/
83
+ <% end -%>
84
+ depends_on:
85
+ redis-db:
86
+ condition: service_started
87
+ <% if deploy_database == 'postgresql' -%>
88
+ postgres-db:
89
+ condition: service_healthy
90
+ <% elsif deploy_database == 'mysql' -%>
91
+ mysql-db:
92
+ condition: service_healthy
93
+ <% end -%>
71
94
  <% 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.0.1
4
+ version: 1.0.2
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-30 00:00:00.000000000 Z
11
+ date: 2023-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails