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

Removing obsolete and not supported shell scripts. Updating docs with… #24

Merged
merged 5 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ chromium_multi: node_base_multi
cd ./NodeChromium && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) -t $(NAME)/node-chromium:$(TAG_VERSION) .

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

standalone_firefox_multi: firefox_multi
cd ./Standalone && docker buildx build --platform $(PLATFORMS) $(BUILD_ARGS) $(FROM_IMAGE_ARGS) --build-arg BASE=node-firefox -t $(NAME)/standalone-firefox:$(TAG_VERSION) .
Expand Down
38 changes: 0 additions & 38 deletions NodeChromium/Dockerfile.ubuntubad

This file was deleted.

13 changes: 0 additions & 13 deletions NodeChromium/generate.sh

This file was deleted.

51 changes: 10 additions & 41 deletions NodeFirefox/README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,28 @@
## Building NodeFirefox and StandaloneFirefox for ARM64
## Building Multi-arch NodeFirefox and StandaloneFirefox

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.
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.

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

### Step 0

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.
**To build node/firefox for arm64:**

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

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


### Step 1

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:

```
$ cd NodeFirefox
$ sh build-step-1.sh # This installs dependencies and drops you into a container bash shell
```

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:

```
$ sh build-geckodriver-arm64.sh
```

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:

$ NAME=local-seleniarm VERSION=4.5.0 BUILD_DATE=$(date '+%Y%m%d') PLATFORMS=linux/arm64 BUILD_ARGS=--load make standalone_firefox_multi
```
$ exit
```

Before proceeding to the next step, verify the geckodriver binary is inside the NodeFirefox folder.


### Step 2

At this stage, we're ready to build both NodeFirefox and StandaloneFirefox. To build these images, run the following command:

```
$ sh build-step-2.sh
```

After this completes, we see all of the container images, both with the latest tag and today's date, using `docker image ls`.

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

## Running the StandaloneFirefox image
## Running the standalone image

```
$ docker run --rm -it --shm-size 3g -p 4444:4444 -p 5900:5900 -p 7900:7900 local-seleniarm/standalone-firefox:latest
$ docker run --rm -it --shm-size 2g -p 4444:4444 -p 5900:5900 -p 7900:7900 local-seleniarm/standalone-firefox:latest
```

As with the x86_64 images from upstream, this also includes noVNC on port 7900, which we can access via http://localhost:7900
47 changes: 0 additions & 47 deletions NodeFirefox/build-and-deploy-firefox-multi-arch.sh

This file was deleted.

71 changes: 51 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,83 @@

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

Selenium container images are available on [Docker Hub](https://hub.docker.com/u/seleniarm):
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).

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.

## Running the ARM Container Images

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.

The images are also successfully tested on AWS graviton nodes, resulting in better price-performance ratio and lower carbon footprint.

To start the standalone container images, run:

![Chromium](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chromium/chromium_24x24.png) Chromium
```
$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 2g seleniarm/standalone-chromium:latest
```
> 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.

![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_24x24.png) Firefox
```
$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 2g seleniarm/standalone-firefox:latest
```

Use your traditional VNC client via port 5900, and noVNC in the browser via port 7900.

The following multi-arch Seleniarm container images are available on [Docker Hub](https://hub.docker.com/u/seleniarm):

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

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

## Only Building the Images
> NOTE: Google does not build Chrome for ARM on Linux. Instead, we use Chromium ARM.

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.
## Building the ARM Images

The Standalone folder is the base for all Standalone${browser} images and includes a script that starts the selenium server in standalone mode.
The NodeBase folder is the base for all Node${browser} images and includes a script that starts the selenium server in node mode.
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`.

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.
### Structure of container images:

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.
- The Standalone folder is the base for all Standalone${browser} images and includes a script that starts the selenium server in standalone mode.
- The NodeBase folder is the base for all Node${browser} images and includes a script that starts the selenium server in node mode.

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

```
$ ./build.sh arm64 # or arm/v7 or amd64
```
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.

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).
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:

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

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.
**To build standalone/firefox for arm64:**

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

To start the container image, run:
**To build standalone/chromium for arm64:**

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

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

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

----
The official documentation from seleniumHQ begins here:
# -- The official documentation from seleniumHQ begins here --
----


Expand Down
46 changes: 0 additions & 46 deletions build-and-deploy-multi-arch.sh

This file was deleted.

56 changes: 0 additions & 56 deletions build.sh

This file was deleted.

Loading