Merge pull request #2563 from wairbut-m2c/test/docker-with-headless-chrome
Update Dockerfile to use Headless Chrome
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -1,7 +1,11 @@
|
|||||||
|
# Use Ruby 2.3.6 as base image
|
||||||
FROM ruby:2.3.6
|
FROM ruby:2.3.6
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
# Install essential Linux packages
|
# Install essential Linux packages
|
||||||
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo
|
RUN apt-get update -qq
|
||||||
|
RUN apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip memcached
|
||||||
|
|
||||||
# Files created inside the container repect the ownership
|
# Files created inside the container repect the ownership
|
||||||
RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \
|
RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \
|
||||||
@@ -34,13 +38,22 @@ COPY Gemfile_custom Gemfile_custom
|
|||||||
# Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock
|
# Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock
|
||||||
RUN gem install bundler
|
RUN gem install bundler
|
||||||
|
|
||||||
# Finish establishing our Ruby enviornment
|
# Finish establishing our Ruby environment
|
||||||
RUN bundle install --full-index
|
RUN bundle install --full-index
|
||||||
|
|
||||||
|
# Install Chromium and ChromeDriver for E2E integration tests
|
||||||
|
RUN apt-get update -qq && apt-get install -y chromium
|
||||||
|
RUN wget -N http://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip
|
||||||
|
RUN unzip chromedriver_linux64.zip
|
||||||
|
RUN chmod +x chromedriver
|
||||||
|
RUN mv -f chromedriver /usr/local/share/chromedriver
|
||||||
|
RUN ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
|
||||||
|
RUN ln -s /usr/local/share/chromedriver /usr/bin/chromedriver
|
||||||
|
|
||||||
# Copy the Rails application into place
|
# Copy the Rails application into place
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Define the script we want run once the container boots
|
# Define the script we want run once the container boots
|
||||||
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`)
|
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`)
|
||||||
#CMD [ "config/containers/app_cmd.sh" ]
|
# CMD [ "config/containers/app_cmd.sh" ]
|
||||||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ end
|
|||||||
|
|
||||||
Capybara.register_driver :headless_chrome do |app|
|
Capybara.register_driver :headless_chrome do |app|
|
||||||
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
||||||
chromeOptions: { args: %w(headless window-size=1200,600) }
|
chromeOptions: { args: %w(headless no-sandbox window-size=1200,600) }
|
||||||
)
|
)
|
||||||
|
|
||||||
Capybara::Selenium::Driver.new(
|
Capybara::Selenium::Driver.new(
|
||||||
|
|||||||
Reference in New Issue
Block a user