Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Create a Headless firefox docker image

Create A Headless Firefox Docker Image

Headless firefox docker image

Long time ago I wrote an article how to create a docker image that runs google chrome headless. At that point Firefox didn’t had any support for that . Now that has been stable for a while I’ve decided to come up with an article that will allow you to create a firefox docker image.

The image itself is based on ubuntu and because of that is pretty heavy.

# Base the image off of the latest pre-built ruby image
FROM drecom/ubuntu-ruby:2.4.0

# make and switch to the /code directory which will hold the tests

RUN mkdir /code
##RUN adduser --disabled-password --gecos '' newuser
WORKDIR /code
#
RUN mkdir output && chmod a+w output && mkdir output/logs && mkdir output/rerun
#
## move over the Gemfile and Gemfile.lock before the rest so that we can cache the installed gems
ADD Gemfile /code/Gemfile
ADD Gemfile.lock /code/Gemfile.lock
## Copy credenfials config (specific for zooplapro tests)
ADD config/credentials_automation.yml.examples /code/config/credentials.yml
ADD config/report_portal.yml /code/report_portal.yml
## upgrade to latest version of bundler

#
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee -a /etc/apt/sources.list
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN apt-get update && \
    apt-get -qq -y install libxpm4 \
                           libxrender1 libgtk2.0-0 libnss3 libgconf-2-4 \
                           libpango1.0-0 libxss1 libxtst6 fonts-liberation libappindicator1 xdg-utils
#
#
RUN apt-get update && apt-get install -y google-chrome-stable
#
RUN apt-get install -f
RUN apt-get -y install \
               gtk2-engines-pixbuf \
               xfonts-cyrillic xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable \
               imagemagick x11-apps zip
RUN apt-get install -y firefox
#
#
RUN wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/2.39/chromedriver_linux64.zip
RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/
RUN chmod ugo+rx /usr/local/bin/chromedriver
#
#
#
## copy over the rest of the tests

ADD . /code

RUN gem install bundler

RUN bundle install

So in this image you’ve got chromedriver installed as well and even firefox installed , so it’s your choice which one you want to use , maybe both .

How to run firefox headless

This is my setup to  run firefox headless.

# frozen_string_literal: true

module FirefoxSetup
  class 

Happy Testing!

The post Create a Headless Firefox Docker image appeared first on Testingrepository - Testing repository - selenium webdriver solution and more.



This post first appeared on Testing Repository - Creating Testing, please read the originial post: here

Share the post

Create a Headless firefox docker image

×

Subscribe to Testing Repository - Creating Testing

Get updates delivered right to your inbox!

Thank you for your subscription

×