From ff1fced6099bd0379d096e0da96a2f55e6645516 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Wed, 28 Mar 2018 10:14:57 -0400 Subject: [PATCH 1/5] Update Dockerfile to install Headless Chrome --- Dockerfile | 14 ++++++++++++-- spec/rails_helper.rb | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 880d17e43..55b0b31ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ +# Use Ruby 2.3.6 as base image FROM ruby:2.3.6 # 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 && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip # Files created inside the container repect the ownership RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \ @@ -34,9 +35,18 @@ COPY Gemfile_custom Gemfile_custom # Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock RUN gem install bundler -# Finish establishing our Ruby enviornment +# Finish establishing our Ruby environment RUN bundle install --full-index +# Install Chromium and ChromeDriver for E2E integration tests +RUN apt-get update -qq && apt-get install -y chromium-browser +RUN wget -N http://chromedriver.storage.googleapis.com/2.37/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 . . diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8731eb670..1385490c8 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -32,7 +32,7 @@ end Capybara.register_driver :headless_chrome do |app| 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( From 45cbec7736a8e633a637db6bd32dabc179b81b90 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Wed, 28 Mar 2018 10:15:56 -0400 Subject: [PATCH 2/5] Set DEBIAN_FRONTEND as 'noninteractive' to fix debconf warnings --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 55b0b31ca..611f31292 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ # Use Ruby 2.3.6 as base image FROM ruby:2.3.6 +ENV DEBIAN_FRONTEND noninteractive + # Install essential Linux packages RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip From 9836bb63c3631cc51af0473544764d5a5a113661 Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Wed, 28 Mar 2018 10:54:18 -0400 Subject: [PATCH 3/5] Install memcached when building Docker container --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 611f31292..27905a562 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ FROM ruby:2.3.6 ENV DEBIAN_FRONTEND noninteractive # Install essential Linux packages -RUN apt-get update -qq && apt-get install -y build-essential libpq-dev postgresql-client nodejs imagemagick sudo libxss1 libappindicator1 libindicator7 unzip +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 RUN adduser --shell /bin/bash --disabled-password --gecos "" consul \ From 812b43a74be8c6b91e53a1dd9b21589005a959fb Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Thu, 7 Jun 2018 14:10:50 -0400 Subject: [PATCH 4/5] Replace deprecated `chromium-browser` package with `chromium` --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 27905a562..158bf7212 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ RUN gem install bundler RUN bundle install --full-index # Install Chromium and ChromeDriver for E2E integration tests -RUN apt-get update -qq && apt-get install -y chromium-browser +RUN apt-get update -qq && apt-get install -y chromium RUN wget -N http://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip RUN unzip chromedriver_linux64.zip RUN chmod +x chromedriver @@ -55,5 +55,5 @@ COPY . . # 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`) -#CMD [ "config/containers/app_cmd.sh" ] +# CMD [ "config/containers/app_cmd.sh" ] CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] From 8c8668a83c285f9b3eabd804df6b98f128588a5d Mon Sep 17 00:00:00 2001 From: Angel Perez Date: Fri, 13 Jul 2018 18:13:55 -0400 Subject: [PATCH 5/5] Use ChromeDriver 2.40 when building container --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 158bf7212..52547d243 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ 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.37/chromedriver_linux64.zip +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