Created
July 22, 2019 20:29
-
-
Save rafaelrpbelo/004160e3b3d50c9131026ea86b84b170 to your computer and use it in GitHub Desktop.
Docker config for chromedriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Capybara settings to be required by rspec_helper.rb | |
require 'selenium-webdriver' | |
require 'chromedriver/helper' | |
Capybara.server = :puma, { Silent: true } | |
Capybara.register_driver :chrome do |app| | |
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( | |
chromeOptions: { | |
args: %w[ | |
no-sandbox | |
headless | |
disable-popup-blocking | |
disable-gpu | |
window-size=1366,768 | |
disable-dev-shm-usage | |
] | |
} | |
) | |
Capybara::Selenium::Driver.new( | |
app, | |
browser: :chrome, | |
desired_capabilities: capabilities | |
) | |
end | |
Selenium::WebDriver::Chrome::Service.driver_path = '/usr/bin/chromedriver' | |
Capybara.javascript_driver = :chrome |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
db: | |
image: postgres | |
volumes: | |
- db:/var/lib/postgresql/data | |
expose: | |
- 5432 | |
ports: | |
- 5432:5432 | |
app: &app | |
build: | |
context: . | |
dockerfile: Dockerfile | |
env_file: | |
- .env | |
environment: | |
- BUNDLE_PATH=/bundle | |
- DB_HOST=db | |
- DB_USER=postgres | |
volumes: | |
- .:/app | |
- bundle_path:/bundle | |
depends_on: | |
- db | |
web: | |
<<: *app | |
command: bundle exec rails server -b 0.0.0.0 | |
ports: | |
- 3000:3000 | |
volumes: | |
bundle_path: | |
db: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6.3 | |
ENV DEBIAN_FRONTEND=noninteractive \ | |
NODE_VERSION=8.9.1 \ | |
TIMEZONE=America/Sao_Paulo \ | |
CODENAME=stretch \ | |
DISPLAY=:0 \ | |
LANG=en_US.UTF-8 \ | |
LANGUAGE=en_US:en \ | |
LC_ALL=en_US.UTF-8 | |
# Set timezone info | |
RUN cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime | |
# Add postgres source | |
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ $CODENAME-pgdg main" >> \ | |
/etc/apt/sources.list.d/pgdg.list | |
# Add postgres repository | |
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \ | |
apt-key add - | |
RUN sed -i '/deb-src/d' /etc/apt/sources.list && \ | |
apt-get update && \ | |
apt-get install -y \ | |
build-essential \ | |
xvfb \ | |
chromedriver \ | |
google-chrome-stable \ | |
zip \ | |
postgresql-client \ | |
locales | |
# Set locale | |
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ | |
locale-gen | |
# Install node.js | |
RUN curl -sSL "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" | tar xfJ - -C /usr/local --strip-components=1 && \ | |
npm install npm -g | |
WORKDIR /app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment