Sign inSign up

miguelcabgil/selenium_base

By miguelcabgil

•Updated almost 2 years ago

A lightweight Selenium-Python (3.12) base image on Alpine, pre-configured with Firefox for testing.

Image
Web servers
0

182

miguelcabgil/selenium_base repository overview

⁠Selenium Base Image with Firefox for Python 3.12 on Alpine

Docker Pulls Docker Image Size Docker Stars

miguelcabgil/selenium_base is a lightweight Docker image built for Selenium automation using Firefox and Python 3.12, based on Alpine Linux. It’s designed for efficiency, making it ideal for CI/CD workflows, web testing, and automation tasks that require a minimal footprint.

⁠Features

  • Python 3.12 on Alpine Linux for a lightweight foundation.
  • Firefox ESR for stability in long-term browser testing.
  • GeckoDriver pre-installed for Selenium compatibility.
  • Headless Mode support for use in CI/CD and server environments.
  • Essential Build Tools (e.g., gcc, musl-dev, libffi-dev) for Python dependencies.

⁠Getting Started

To use this image, you can pull it directly from Docker Hub:

docker pull miguelcabgil/selenium_base:latest

⁠Selenium Python Automation with Docker

This guide provides an example Dockerfile to run Selenium-based Python scripts in a containerized environment.

⁠Example Dockerfile

Here’s an example Dockerfile to set up and execute your Selenium-based Python scripts:

# Copy your Python script into the container
COPY your_script.py /app/

# Set the working directory
WORKDIR /app

# Run the script
CMD ["python", "your_script.py"]

⁠Running the Container Directly

You can also run your Selenium script directly from this Docker image without creating a custom image. Use the following command to execute the script:

docker run -it --rm -v $(pwd):/app miguelcabgil/selenium_base:latest python /app/your_script.py

⁠Components

This Docker image includes:

  • Python 3.12: Latest stable version on Alpine, ensuring compatibility with modern Python libraries.
  • Firefox ESR: A reliable, stable release of Firefox for consistent testing results.
  • GeckoDriver: Allows Selenium to control Firefox, enabling automated browser interactions.
  • Build Tools: Essential tools for building Python packages, including gcc, musl-dev, and openssl-dev.

⁠Use Cases

This image is optimized for:

  • Automated Browser Testing in CI/CD: Ideal for continuous integration and deployment pipelines.
  • Web Scraping and Data Extraction: Perfect for using Python and Selenium for data-gathering tasks.
  • Headless Automation: Suitable for headless environments where a minimal setup is preferred.

Tag summary

Content type

Image

Digest

sha256:1d94357fc…

Size

234 MB

Last updated

almost 2 years ago

docker pull miguelcabgil/selenium_base