Skip to content

Dockerised python with webdrivers for Chrome and Firefox.

License

Notifications You must be signed in to change notification settings

jameswilliams1/docker-python-webdriver

Repository files navigation

python-webdriver

Code Build License: Apache 2.0 Code style: black


Dockerised python with webdrivers for Chrome and Firefox.

https://github.com/jameswilliams1/docker-python-webdriver

Note: This project is a work in progress and currently only the following tags are supported, providing Chrome and/or Firefox:

  • 3.7-slim-buster-all
  • 3.7-slim-buster-chrome
  • 3.8-slim-buster-all
  • 3.8-slim-buster-chrome

This is the Git repo of the Docker image for python-webdriver. This image is a tool for scraping, testing or any other task that needs a webdriver and a browser. Currently, there are images for Google Chrome with Chromedriver, Mozilla Firefox with Geckodriver, or both. Once the automated Dockerfile scripts are complete, the plan is to provide Chrome and Firefox along with most of the latest versions of python on Debian or Alpine.

Updates are pushed daily for all images by an automated CI pipeline which builds, tests and releases at 06:10am every morning.

How to use this image

Tags

Various versions of python, and either Chrome, Firefox or both can be chosen with the tag format:

<python-version>-<distribution>-<browser>

i.e. for Python 3.8 on Debian Slim Buster, with Chrome and Firefox installed:

docker pull jameswilliams1/python-webdriver:3.8-slim-buster-all

Usage

This image runs as root by default. If you are using it in production your Dockerfile should change this. The image is primarily intended for use with the Selenium WebDriver python bindings. Selenium is not installed by default as this should generally be handled through a requirements file for your project. The chosen browser and webdriver are installed, and the system is configured to allow headless execution in Docker out of the box. Setup is similar to any other python image:

FROM jameswilliams1/python-webdriver:3.8-slim-buster-all
COPY ./Pipfile ./Pipfile.lock /tmp/
WORKDIR /tmp/
RUN pip install --no-cache-dir pipenv \
    && pipenv install --deploy --system
    && rm -rf /tmp/*
COPY . /app
WORKDIR /app
ENTRYPOINT ["./entrypoint.sh"]

Issues and Suggestions

Please report any issues or feature suggestions on the issues page.