Last active
January 17, 2020 22:25
-
-
Save dennismclaugh/7a32dc616de0fa1ccf7f8de13bdaeca1 to your computer and use it in GitHub Desktop.
Dockerfile based on Alpine Linux complete with Ruby, Watir Webdriver, Shopify API, Chrome, and Firefox. https://www.dennismclaughlin.tech/build-docker-image-ruby-watir-webdriver-shopify-and-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
FROM alpine:latest | |
# Point to specific Alpine Package repositories for Chromium and Firefox. | |
RUN apk update && apk upgrade \ | |
&& echo @latest-stable http://nl.alpinelinux.org/alpine/latest-stable/community >> /etc/apk/repositories \ | |
&& echo @latest-stable http://nl.alpinelinux.org/alpine/latest-stable/main >> /etc/apk/repositories \ | |
&& echo @edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories \ | |
&& echo @edge-main http://dl-cdn.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories | |
# Install Ruby dev environment | |
RUN apk add --no-cache build-base libffi-dev ruby-dev ruby-rdoc ruby-webrick@latest-stable zlib-dev | |
# Install Chromium | |
RUN apk add --no-cache chromium-chromedriver chromium@latest-stable harfbuzz@latest-stable nss@latest-stable | |
# Install Firefox and the Gechodriver | |
RUN apk add --no-cache icu-libs@edge-main firefox@edge-testing | |
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz && \ | |
tar -zxvf geckodriver-v0.24.0-linux64.tar.gz && \ | |
mv ./geckodriver /usr/local/bin/ && \ | |
chmod a+x /usr/local/bin/geckodriver | |
# Install Ruby gems required by the test framework. | |
RUN gem install rake minitest minitest-reporters watir:6.16 shopify_api bigdecimal aws-sdk-s3 | |
# Clean up leftovers to help keep the final image small. | |
RUN rm -rf /var/lib/apt/lists/* \ | |
/var/cache/apk/* \ | |
/usr/share/man \ | |
/tmp/* | |
# Copy the automated tests into the container. | |
ADD . webdriver-tests | |
# Add 'webdriver' as a user | |
RUN adduser -D webdriver \ | |
&& chown -R webdriver:webdriver /webdriver-tests | |
# Switch to non-privileged user 'webdriver' | |
USER webdriver | |
WORKDIR /webdriver-tests | |
# Set the environment variables for the Chromium browser. | |
ENV CHROME_BIN=/usr/bin/chromium-browser \ | |
CHROME_PATH=/usr/lib/chromium/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment