Sign inSign up

pak00329/selenium_python_chrome_lite

By pak00329

•Updated almost 2 years ago

A lightweight web scraper

Image
Monitoring & observability
0

1.1K

pak00329/selenium_python_chrome_lite repository overview

This Dockerfile creates a lightweight, flexible container optimized for running Python-based Selenium scripts with Chromium browser support. Below is an outline of the key components and their functions:

⁠Base Image
  • FROM python:3.11-slim:
    • Utilizes the official slim version of Python 3.11 to minimize the image size while ensuring access to Python’s latest features and security updates.
⁠System Dependencies
  • RUN apt-get update && apt-get install:
    • Installs essential system packages:
      • chromium: Lightweight web browser for headless automation.
      • chromium-driver: WebDriver for Selenium to control Chromium.
      • Cleans up apt cache to reduce image size.
⁠Application Setup
  • WORKDIR /app:
    • Sets the working directory inside the container to /app, where the code and dependencies are located.
  • COPY requirements.txt .:
    • Copy the build requirements.
⁠Python Dependencies
  • RUN pip install --upgrade pip:
    • Ensures the latest version of pip is used for dependency management.
  • pip install --no-cache-dir -r requirements.txt:
    • Installs all required Python libraries listed in requirements.txt without caching to save space.
⁠Selenium Installation
  • RUN pip install selenium==4.25.0:
  • Installs Selenium version 4.25.0 for automated web testing.
⁠Entry Point
  • ENTRYPOINT:
    • Provides a dynamic entry point for the container, allowing the user to define the script to be run via the SCRIPT_NAME environment variable.
    • Ensures requirements.txt is reinstalled on each run for up-to-date dependencies.

⁠Key Features

  1. Lightweight and Flexible: Built on a slim Python image to keep the size minimal.
  2. Chromium and Selenium Integration: Pre-configured for running headless browser tests with Chromium.
  3. Dynamic Script Execution: Allows passing different Python scripts via the SCRIPT_NAME environment variable, making it versatile for various automation tasks.

This image is ideal for automated testing, web scraping, or any headless browser automation tasks using Selenium with Python.

Tag summary

Content type

Image

Digest

sha256:237f3a9aa…

Size

320.6 MB

Last updated

almost 2 years ago

docker pull pak00329/selenium_python_chrome_lite