spryker/docker-chromedriver 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spryker/docker-chromedriver

Composer 安装命令:

composer require spryker/docker-chromedriver

包简介

Source of Chromedriver with Chromium for building Docker containers and integrated usage.

README 文档

README

This is a Dockerfile to create a Webdriver image with ChromeDriver and Chromium out-of-box.

Usage

General

The spryker/chromedriver image is public and available on Docker Hub. You can use this repository to run and install Chromedriver with appropriate version of Chromium within:

Docker

The spryker/chromedriver is available on Docker Hub. starts a Chromedriver server on port 4444 by default. In its turn, Chromedriver wraps Webdriver to run tests within Chromium ecosystem.

The very basic docker-compose configuration that is sufficient to use Chromium and Chromedriver within your ecosystem is next:

version: "3.7"
services:
  chromedriver:
    image: spryker/chromedriver
    init: true
    environment:
      - CHROMIUM_VERSION=726767
    volumes:
      - ./assets:/home/webdriver/assets:ro
    expose:
      - "4444"

You can control the revision of Chromium (and Chromedriver as well) with just putting CHROMIUM_REVISION environment variable into docker-compose template (as mentioned above).

Composer

To install Chromedriver with Chromium onboard, you just need to run

composer require --dev "spryker/docker-chromedriver"

and modify composer.json file to make all necessary installation actions:

{
  "scripts": {
    "post-install-cmd": [
      "ChromedriverInstaller\\Installer::installChromedriver"
    ],
    "post-update-cmd": [
      "ChromedriverInstaller\\Installer::installChromedriver"
    ]
  }
}

This will lead to install of the latest nightly build of Chromedriver and Chromium.

To freeze version of Chromedriver you can take on any revision number and mention it within composer.json configuration (just ensure your revision contains both Chromedriver and Chromium archives):

{
  "config": {
    "chromium-revision": 814168
  }
}

Next time you will run Composer install/update, script will check whether the revision has changed and/or differs from latest/fixed one. If so, it will install the actual version of Chromedriver. Nothing will happen in else case. This is to reduce Composer worktime.

Skip installation

To ignore Chromedriver installation process just set the appropriate variable berfore running Composer:

export COMPOSER_IGNORE_CHROMEDRIVER=1

This will force skipping installation procedure during Composer run.

Travis CI

To use this package within Travis image you just need to use chromium-installer to prepare Chromium and Chromedriver for run.

First of all, you need to specify cache directory:

cache:
  directories:
    - $HOME/chromium-ecosystem

Then download and unzip installer:

before_install:
  # Chromedriver section
  - curl -L "https://github.com/spryker/docker-chromedriver/archive/master.zip" -o $HOME/chromium-ecosystem/chromiumdriver.zip
  - unzip -o $HOME/chromium-ecosystem/chromiumdriver.zip -d $HOME/chromium-ecosystem/
  # Here you can leave 0 for installing latest nightly build
  - export CHROMEDRIVER_REVISION=814168

And finally run installer:

  # Exposes ${CHROMEDRIVER_BINARY} and ${CHROMIUM_BINARY}
  - . $HOME/chromium-ecosystem/chromiumdriver-master/chromium-installer $CHROMEDRIVER_REVISION $HOME/chromium-ecosystem false

And finally, ensure you have added all dependencies, needed to run Chromium:

addons:
  apt:
    update: true
    packages:
      - unzip
      - gnupg
      - libnss3-dev
      - ca-certificates
      - fonts-liberation
      - libappindicator3-1
      - libasound2
      - libatk-bridge2.0-0
      - libatk1.0-0
      - libc6
      - libcairo2
      - libcups2
      - libdbus-1-3
      - libexpat1
      - libfontconfig1
      - libgbm1
      - libgcc1
      - libglib2.0-0
      - libgtk-3-0
      - libnspr4
      - libnss3
      - libpango-1.0-0
      - libpangocairo-1.0-0
      - libstdc++6
      - libx11-6
      - libx11-xcb1
      - libxcb1
      - libxcomposite1
      - libxcursor1
      - libxdamage1
      - libxext6
      - libxfixes3
      - libxi6
      - libxrandr2
      - libxrender1
      - libxss1
      - libxtst6
      - lsb-release
      - wget
      - xdg-utils

That's it! Now you can just run Chromedriver and pass right Chromium executable into Webdriver config:

script:
- bash -c "${CHROMEDRIVER_BINARY} --port=4444 --whitelisted-ips= --url-base=/wd/hub --log-path=/tmp/chromedriver.log --log-level=DEBUG" > /dev/null &

Dependencies

To run Chromedriver with Chromium you need to install this list of dependencies beforehand:

apt-get update && apt-get install gnupg \
      libnss3-dev \
      ca-certificates \
      fonts-liberation \
      libappindicator3-1 \
      libasound2 \
      libatk-bridge2.0-0 \
      libatk1.0-0 \
      libc6 \
      libcairo2 \
      libcups2 \
      libdbus-1-3 \
      libexpat1 \
      libfontconfig1 \
      libgbm1 \
      libgcc1 \
      libglib2.0-0 \
      libgtk-3-0 \
      libnspr4 \
      libnss3 \
      libpango-1.0-0 \
      libpangocairo-1.0-0 \
      libstdc++6 \
      libx11-6 \
      libx11-xcb1 \
      libxcb1 \
      libxcomposite1 \
      libxcursor1 \
      libxdamage1 \
      libxext6 \
      libxfixes3 \
      libxi6 \
      libxrandr2 \
      libxrender1 \
      libxss1 \
      libxtst6 \
      lsb-release \
      wget \
      xdg-utils

Software

The following software is included in this image:

Pay attention

Since this package relies on nightly builds, not all versions of Chromium are available to download. To check the available revisions, please visit Google Chromium Snapshots archive and find appropriate snapshot revision.

spryker/docker-chromedriver 适用场景与选型建议

spryker/docker-chromedriver 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 1.66M 次下载、GitHub Stars 达 9, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 spryker/docker-chromedriver 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 spryker/docker-chromedriver 我们能提供哪些服务?
定制开发 / 二次开发

基于 spryker/docker-chromedriver 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.66M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 45
  • 依赖项目数: 10
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 6
  • Forks: 2
  • 开发语言: Shell

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04