== Building Images === What's Inside Images Each image consists of 3 layers: . **Base layer** - contains stuff needed in every image: Xvfb, fonts, locales, cursor blinking fix, timezone definition and so on. You have to build this layer manually. . **Browser layer** - contains browser binary. . **Driver layer** - contains either respective web driver binary or corresponding Selenium \ Selenoid server version. === Building Procedure Building procedure is automated with a Go binary. All Docker build files are embedded to this binary. To build the binary from source: [source,bash] ---- $ go get github.com/markbates/pkger/cmd/pkger $ go generate github.com/aerokube/images $ go build ---- To show help: [source,bash] ---- $ ./images --help $ ./images firefox --help ---- * Before building images you can optionally clone tests repository: + [source,bash] ---- $ git clone https://github.com/aerokube/selenoid-container-tests.git ---- + These tests require Java and Maven 3 to be installed. Tests directory should be cloned to this repository parent directory: + [source,bash] ---- images/ # <== this repo selenoid-container-tests/ # <== optional tests repo ---- * To build a Firefox image use the following command: + [source,bash] ---- $ ./images firefox -b 79.0+build1-0ubuntu0.18.04.1 -d 0.26.0 --selenoid-version 1.10.0 -t selenoid/firefox:79.0 ---- + Here `79.0+build1-0ubuntu0.18.04.1` is `firefox` package version for Ubuntu 18.04, `1.10.10` is https://github.com/aerokube/selenoid/releases[Selenoid] version to use inside image (just use latest release version here), `selenoid/firefox:79.0` is Docker tag to be applied, `0.26.0` is http://github.com/mozilla/geckodriver/releases[Geckodriver] version to use. + If you wish to automatically use the latest Selenoid and Geckodriver versions - just omit respective flags or use **latest** as value: + [source,bash] ---- $ ./images firefox -b 79.0+build1-0ubuntu0.18.04.1 -t selenoid/firefox:79.0 ---- + If you wish to pack a local Debian package instead of APT - just replace package version with full path to **deb** file: + [source,bash] ---- $ ./images firefox -b /path/to/firefox_79.0+build1-0ubuntu0.18.04.1_amd64.deb -t selenoid/firefox:79.0 ---- + It is important to use package files with full version specified name because automation scripts determine browser version by parsing package file name! + To run the tests after building the image add `--test` flag: + [source,bash] ---- $ ./images firefox -b 79.0+build1-0ubuntu0.18.04.1 -t selenoid/firefox:79.0 --test ---- + To push image after building add `--push` flag: + [source,bash] ---- $ ./images firefox -b 79.0+build1-0ubuntu0.18.04.1 -t selenoid/firefox:79.0 --push ---- * To build a Chrome image use the following command: + [source,bash] ---- $ ./images chrome -b 78.0.3904.97-1 -d 78.0.3904.70 -t selenoid/chrome:78.0 ---- + Here `78.0.3904.97-1` is `google-chrome-stable` package version for Ubuntu 18.04, `78.0.3904.70` is https://chromedriver.storage.googleapis.com/index.html[Chromedriver] version, `selenoid/chrome:78.0` is Docker tag to be applied. + If you wish to automatically use the latest https://chromedriver.chromium.org/downloads/version-selection[compatible] Chromedriver version - just omit respective flag or use **latest** as value: + [source,bash] ---- $ ./images chrome -b 78.0.3904.97-1 -d latest -t selenoid/chrome:78.0 ---- * To build a Microsoft Edge image use the following command: + [source,bash] ---- $ ./images edge -b 88.0.673.0-1 -d 88.0.673.0 -t selenoid/edge:88.0 ---- * To build an Opera image use the following command: + [source,bash] ---- $ ./images opera -b 64.0.3417.92 -d 77.0.3865.120 -t selenoid/opera:64.0 ---- + Here `64.0.3417.92` is `opera-stable` package version for Ubuntu 18.04, `77.0.3865.120` is https://github.com/operasoftware/operachromiumdriver/releases[Operadriver] version, `64.0` is Docker tag to be applied. * To build a Yandex image use the following command: + [source,bash] ---- $ ./images yandex -b 20.4.3.268-1 -d 20.4.3.321 -t selenoid/yandex-browser:20.4 ---- + Here `20.4.3.268-1` is `yandex-browser-beta` package version for Ubuntu 18.04, `20.4.3.321` is https://github.com/yandex/YandexDriver/releases[Yandexdriver] Linux asset version, `20.4` is Docker tag to be applied. * To build an Android image use the following command: + [source,bash] ---- $ cd selenium $ ./automate_android.sh ---- This command is interactive - just answer the questions and it will build an image for you. In order to bundle custom APK to image - put it to `selenium/android` directory before running the script. === Selecting Browser Channel Apart from the default stable release channel, the following ones are also supported: .Available Browser Channels |=== | Browser | Channel | Package | | firefox | beta | firefox (http://launchpad.net/~mozillateam/+archive/firefox-next/+packages[PPA]) | | firefox | dev | firefox-trunk (http://launchpad.net/~ubuntu-mozilla-daily/+archive/ppa/+packages[PPA]) | | firefox | esr | firefox-esr (http://launchpad.net/~mozillateam/+archive/ppa/+packages[PPA]) | | chrome | beta | google-chrome-beta | | chrome | dev | google-chrome-unstable | | opera | beta | opera-beta | | opera | dev | opera-developer | |=== To build an image for one of the channels above use the `--channel` flag as follows: [source,bash] ---- $ ./images firefox -b 72.0~a1~hg20191114r501767-0ubuntu0.18.04.1~umd1 --channel dev -t selenoid/firefox:72.0a1 ----