Skip to content

Instantly share code, notes, and snippets.

Last active Jan 17, 2020
What would you like to do?
Dockerfile based on Alpine Linux complete with Ruby, Watir Webdriver, Shopify API, Chrome, and Firefox.
FROM alpine:latest
# Point to specific Alpine Package repositories for Chromium and Firefox.
RUN apk update && apk upgrade \
&& echo @latest-stable >> /etc/apk/repositories \
&& echo @latest-stable >> /etc/apk/repositories \
&& echo @edge-testing >> /etc/apk/repositories \
&& echo @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 && \
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 \
# 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 \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment