Browse Source

Remove autoloading of Webdrivers in docker env

Andrew Swistak 6 năm trước cách đây
mục cha
commit
62c4e910bc
3 tập tin đã thay đổi với 16 bổ sung12 xóa
  1. 5 4
      Dockerfile
  2. 1 1
      Gemfile
  3. 10 7
      spec/capybara_helper.rb

+ 5 - 4
Dockerfile

@@ -29,7 +29,9 @@ RUN yarn install && yarn cache clean
 
 # Copy our app over now
 COPY bin/ /app/bin
-COPY .rspec Rakefile .ruby-version /app/
+COPY Rakefile /app/
+COPY .rspec .ruby-version tsconfig.json babel.config.js postcss.config.js \
+  .browserslistrc .prettierrc.js .rubocop.yml .eslintrc.js /app/
 COPY vendor/ /app/vendor
 COPY config.ru /app/config.ru
 COPY config/ /app/config
@@ -38,8 +40,7 @@ COPY public/ /app/public
 COPY storage/ /app/storage
 COPY lib/ /app/lib
 COPY db/ /app/db
-COPY app/assets/ /app/app/assets
-COPY app/javascript/ /app/app/javascript
+COPY app/ /app/app
 
 # Compile our assets, moving unneeded directories out of way for the prod image
 # after compilation has completed.
@@ -53,7 +54,7 @@ FROM base AS dev
 COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
 COPY --from=builder /app/ /app/
 COPY --from=builder /var/cache/app/ /app/
-COPY spec /app/spec
+COPY spec/ /app/spec
 
 # Watchman is required for relay-compiler to run in watch mode
 COPY --from=icalialabs/watchman /usr/local/bin/watchman* /usr/local/bin/

+ 1 - 1
Gemfile

@@ -55,7 +55,7 @@ group :test do
   gem 'capybara', '>= 2.15'
   gem 'selenium-webdriver'
   gem 'simplecov', require: false
-  gem 'webdrivers'
+  gem 'webdrivers', require: false
 end
 
 # Windows does not include zoneinfo files, so bundle the tzinfo-data gem

+ 10 - 7
spec/capybara_helper.rb

@@ -2,19 +2,22 @@
 
 require 'capybara/rspec'
 require 'selenium/webdriver'
-require 'webdrivers'
-
-# Only check Webdrivers updates onces per day
-Webdrivers.cache_time = 86_400
-
-Capybara.default_max_wait_time = 10
-Capybara.server = :puma, {Silent: true}
 
 # Check if Capybara should be running against a remote Selenium instance
 def remote_selenium?
   (ENV['SELENIUM_FIREFOX_HOST'] || ENV['SELENIUM_CHROME_HOST']) && ENV['SELENIUM_PORT']
 end
 
+if !remote_selenium?
+  require 'webdrivers'
+
+  # Only check Webdrivers updates onces per day
+  Webdrivers.cache_time = 86_400
+end
+
+Capybara.default_max_wait_time = 10
+Capybara.server = :puma, {Silent: true}
+
 # Condtionally swap driver setup, defaults to `:headless_firefox`
 def selenium_driver
   return @selenium_driver if @selenium_driver