Skip to content
This repository was archived by the owner on Jun 22, 2024. It is now read-only.

Commit 303edea

Browse files
Merge pull request #24 from seleniumhq-community/fix-build-instructions
Removing obsolete and not supported shell scripts. Updating docs with…
2 parents 85e61f0 + 111ef9f commit 303edea

12 files changed

+62
-325
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ chromium_multi: node_base_multi
155155
cd ./NodeChromium && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-chromium:$(TAG_VERSION) .
156156

157157
firefox_multi: node_base_multi
158-
cd ./NodeFirefox && docker buildx build -f Dockerfile.arm64 --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-firefox:$(TAG_VERSION) .
158+
cd ./NodeFirefox && docker buildx build -f Dockerfile.multi-arch --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-firefox:$(TAG_VERSION) .
159159

160160
standalone_firefox_multi: firefox_multi
161161
cd ./Standalone && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg BASE=node-firefox -t $(NAME)/standalone-firefox:$(TAG_VERSION) .

NodeChromium/Dockerfile.ubuntubad

-38
This file was deleted.

NodeChromium/generate.sh

-13
This file was deleted.
File renamed without changes.

NodeFirefox/README.md

+10-41
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,28 @@
1-
## Building NodeFirefox and StandaloneFirefox for ARM64
1+
## Building Multi-arch NodeFirefox and StandaloneFirefox
22

3-
I haven't located a geckdriver binary for Debian, so we'll build it from source. Unfortunately, the build step cannot yet be automated. Trying to run it as part of a docker build or even using docker exec causes the build to fail for reasons unknown to me.
3+
There are two Dockerfiles in NodeFirefox. `Dockerfile` is from the upstream repository for building the standard, official amd64 images. To build `seleniarm/node-firefox` for arm64 or armv7l (or possibly amd64 as well), we use the `Dockerfile.multi-arch` file.
44

5-
As a result, I split the build process into various steps:
5+
The easiest way to build the image is to use `make`. See examples below:
66

7-
### Step 0
87

9-
Make sure the local-seleniarm/base:latest and local-seleniarm/node-base:latest have been built using the command that builds all of the other images. If you haven't yet done this, run this from the root of the repository.
8+
**To build node/firefox for arm64:**
109

1110
```
12-
$ sh build.sh
11+
$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm64 BUILD_ARGS=--load make firefox_multi
1312
```
1413

15-
Before proceeding, verify that local-seleniarm/base:latest and local-seleniarm/node-base:latest exist by using `docker image ls`.
14+
**To build standalone/firefox for arm64:**
1615

17-
18-
### Step 1
19-
20-
In Step 1, we'll build the geckodriver. The geckodriver must be built specifically for Debian and specifically for the ARM64 platform, and we'll use an intermediate, throwaway Debian container to automatically setup the build environment by installing all of the needed dependencies. Once the build environment is setup, we'll need to manually run the compile step. To start this process, run the following command from the NodeFirefox working directory:
21-
22-
```
23-
$ cd NodeFirefox
24-
$ sh build-step-1.sh # This installs dependencies and drops you into a container bash shell
25-
```
26-
27-
Once the dependencies are installed, we'll automatically drop into the container's shell in the `/opt/geckodriver` directory. At this stage, run this command:
28-
29-
```
30-
$ sh build-geckodriver-arm64.sh
3116
```
32-
33-
This uses Rust and cargo to build geckodriver. Afterwards, the script copies the binary to `/media/share` on the host. The script then moves it to the NodeFirefox directory where it will be copied into the NodeFirefox image in the next step. Once built, exit the container:
34-
17+
$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm64 BUILD_ARGS=--load make standalone_firefox_multi
3518
```
36-
$ exit
37-
```
38-
39-
Before proceeding to the next step, verify the geckodriver binary is inside the NodeFirefox folder.
40-
41-
42-
### Step 2
43-
44-
At this stage, we're ready to build both NodeFirefox and StandaloneFirefox. To build these images, run the following command:
45-
46-
```
47-
$ sh build-step-2.sh
48-
```
49-
50-
After this completes, we see all of the container images, both with the latest tag and today's date, using `docker image ls`.
5119

20+
NOTE: Replace PLATFORMS environment variable with `linux/arm/v7` for armv7l/armhf, or `linux/amd64` for amd64.
5221

53-
## Running the StandaloneFirefox image
22+
## Running the standalone image
5423

5524
```
56-
$ docker run --rm -it --shm-size 3g -p 4444:4444 -p 5900:5900 -p 7900:7900 local-seleniarm/standalone-firefox:latest
25+
$ docker run --rm -it --shm-size 2g -p 4444:4444 -p 5900:5900 -p 7900:7900 local-seleniarm/standalone-firefox:latest
5726
```
5827

5928
As with the x86_64 images from upstream, this also includes noVNC on port 7900, which we can access via http://localhost:7900

NodeFirefox/build-and-deploy-firefox-multi-arch.sh

-47
This file was deleted.

README.md

+51-20
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,83 @@
22

33
[![seleniumhq-community](https://circleci.com/gh/seleniumhq-community/docker-seleniarm.svg?style=shield)](https://app.circleci.com/pipelines/github/seleniumhq-community/docker-seleniarm)
44

5-
Selenium container images are available on [Docker Hub](https://hub.docker.com/u/seleniarm):
5+
This is a fork of [SeleniumHQ/docker-selenium](https://github.com/SeleniumHQ/docker-selenium) for building and maintaining docker-selenium ARM images. This fork is inspired by and based on changes from [sj26/docker-selenium](https://github.com/sj26/docker-selenium) and [rows/docker-selenium](https://github.com/rows/docker-selenium).
6+
7+
NOTE: If you only need the Intel/amd64 images, please see the official upstream [SeleniumHQ/docker-selenium](https://github.com/SeleniumHQ/docker-selenium) repository for best results.
8+
9+
## Running the ARM Container Images
10+
11+
The primary motivation for creating this fork and updating the images was so I can use the noVNC client on the latest Selenium versions on the Mac M1, an arm64 architecture. To use noVNC, make sure you open port 7900, and visit localhost:7900 in your browser.
12+
13+
The images are also successfully tested on AWS graviton nodes, resulting in better price-performance ratio and lower carbon footprint.
14+
15+
To start the standalone container images, run:
16+
17+
![Chromium](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chromium/chromium_24x24.png) Chromium
18+
```
19+
$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 2g seleniarm/standalone-chromium:latest
20+
```
21+
> NOTE: Google does not build Chrome for Linux ARM platforms. Instead, docker-seleniarm uses the open source Chromium browser instead, which _is_ built for ARM.
22+
23+
![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_24x24.png) Firefox
24+
```
25+
$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 2g seleniarm/standalone-firefox:latest
26+
```
27+
28+
Use your traditional VNC client via port 5900, and noVNC in the browser via port 7900.
29+
30+
The following multi-arch Seleniarm container images are available on [Docker Hub](https://hub.docker.com/u/seleniarm):
631

732
- [Standalone Chromium](https://hub.docker.com/r/seleniarm/standalone-chromium)
833
- [Standalone Firefox](https://hub.docker.com/r/seleniarm/standalone-firefox)
934
- [Node Chromium](https://hub.docker.com/r/seleniarm/node-chromium)
1035
- [Node Firefox](https://hub.docker.com/r/seleniarm/node-firefox)
1136
- [Selenium Hub](https://hub.docker.com/r/seleniarm/hub)
1237

13-
For other images, see the next section to build them yourself.
38+
The other upstream images are not yet supported for multi-arch, but you can try and build them yourself.
1439

15-
## Only Building the Images
40+
> NOTE: Google does not build Chrome for ARM on Linux. Instead, we use Chromium ARM.
1641
17-
If you want to build the images locally, without pushing to any registry, then use the build.sh script in the root of the project directory.
42+
## Building the ARM Images
1843

19-
The Standalone folder is the base for all Standalone${browser} images and includes a script that starts the selenium server in standalone mode.
20-
The NodeBase folder is the base for all Node${browser} images and includes a script that starts the selenium server in node mode.
44+
The entire build process is managed via a Makefile. If you want to build the images locally, without pushing to any registry, then use `make`.
2145

22-
Inside build.sh are environment variables which are used to tag the built images. If changing the Selenium version, note that you must also edit the Base/Dockerfile and change which selenium-server version is downloaded via wget. The Chromium version is set in NodeChromium/Dockerfile.txt.
46+
### Structure of container images:
2347

24-
The build.sh script only builds the standalone images, node images, and the hub. You are welcome to try and build and test the other images, if you need them.
48+
- The Standalone folder is the base for all Standalone${browser} images and includes a script that starts the selenium server in standalone mode.
49+
- The NodeBase folder is the base for all Node${browser} images and includes a script that starts the selenium server in node mode.
2550

26-
To build the images, run build.sh from the root directory of this repo, and specify your architecture, either arm64, arm/v7, or amd64:
51+
To build with a different version of Chromium, change it in NodeChromium/Dockerfile.
2752

28-
```
29-
$ ./build.sh arm64 # or arm/v7 or amd64
30-
```
53+
The multi-arch Seleniarm images are only built for the standalone and node browser images, and the hub. You are welcome to try and build and test the other images, if you need them.
3154

32-
This is a fork of [SeleniumHQ/docker-selenium](https://github.com/SeleniumHQ/docker-selenium) and based on changes from [sj26/docker-selenium](https://github.com/sj26/docker-selenium) and [rows/docker-selenium](https://github.com/rows/docker-selenium).
55+
To build the images, run the following make command from the root directory of this repo, and specify your architecture, either arm64, arm/v7, or amd64:
3356

34-
Multi-arch images are located at https://hub.docker.com/u/seleniarm
57+
**To build all arm64 images:**
58+
```
59+
$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm64 BUILD_ARGS=--load make build_multi
60+
```
3561

36-
The primary motivation for creating this fork and updating the images is so I can use the noVNC client on Selenium 4.0.0 on the Mac M1, an arm64 architecture. To use noVNC, make sure you open port 7900, and visit localhost:7900 in your browser.
62+
**To build standalone/firefox for arm64:**
3763

38-
The images are also successfully tested on AWS graviton nodes, resulting in better price-performance ratio and lower carbon footprint.
64+
```
65+
$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm64 BUILD_ARGS=--load make standalone_firefox_multi
66+
```
3967

40-
To start the container image, run:
68+
**To build standalone/chromium for arm64:**
4169

4270
```
43-
$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 3g local-seleniarm/standalone-chromium:latest
71+
$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm64 BUILD_ARGS=--load make standalone_chromium_multi
4472
```
4573

46-
Use your traditional VNC client via port 5900, and noVNC in the browser via port 7900.
74+
To build for armv7l/armhf, replace PLATFORMS environment variable with `linux/arm/v7` like so:
4775

76+
```
77+
$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm/v7 BUILD_ARGS=--load make standalone_chromium_multi
78+
```
4879

4980
----
50-
The official documentation from seleniumHQ begins here:
81+
# -- The official documentation from seleniumHQ begins here --
5182
----
5283

5384

build-and-deploy-multi-arch.sh

-46
This file was deleted.

build.sh

-56
This file was deleted.

0 commit comments

Comments
 (0)