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

Commit 547a95d

Browse files
Changed Debian mirrors to Hong Kong. Added browser version to NodeFirefox Dockerfile. Added shell variables for build-step-2.sh. Fixed echo statements to print the VERSION and BUILD_DATE. Added README file in NodeFirefox with build instructions. Added generate.sh script to build-step-2.sh and used Dockerfile.arm64 as the source.
1 parent d62f6cf commit 547a95d

File tree

7 files changed

+120
-42
lines changed

7 files changed

+120
-42
lines changed

NodeFirefox/Dockerfile

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,28 @@
22
# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED.
33
# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE
44
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5-
FROM selenium/node-base:4.0.0-20211013
6-
LABEL authors=SeleniumHQ
5+
FROM local-seleniarm/node-base:4.0.0-20211111
6+
LABEL authors=SeleniumHQ,sj26,jamesmortensen
7+
8+
#FROM local-seleniarm/node-base:4.0.0-20211018
9+
#LABEL authors=SeleniumHQ,sj26,jamesmortensen
710

811
USER root
912

1013
#=========
1114
# Firefox
1215
#=========
13-
ARG FIREFOX_VERSION=latest
14-
RUN FIREFOX_DOWNLOAD_URL=$(if [ $FIREFOX_VERSION = "latest" ] || [ $FIREFOX_VERSION = "nightly-latest" ] || [ $FIREFOX_VERSION = "devedition-latest" ] || [ $FIREFOX_VERSION = "esr-latest" ]; then echo "https://download.mozilla.org/?product=firefox-$FIREFOX_VERSION-ssl&os=linux64&lang=en-US"; else echo "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2"; fi) \
16+
RUN echo "deb http://ftp.hk.debian.org/debian/ sid main" >> /etc/apt/sources.list \
1517
&& apt-get update -qqy \
16-
&& apt-get -qqy --no-install-recommends install firefox libavcodec-extra \
17-
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
18-
&& wget --no-verbose -O /tmp/firefox.tar.bz2 $FIREFOX_DOWNLOAD_URL \
19-
&& apt-get -y purge firefox \
20-
&& rm -rf /opt/firefox \
21-
&& tar -C /opt -xjf /tmp/firefox.tar.bz2 \
22-
&& rm /tmp/firefox.tar.bz2 \
23-
&& mv /opt/firefox /opt/firefox-$FIREFOX_VERSION \
24-
&& ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox
18+
&& apt-get -qqy install firefox-esr libavcodec-extra \
19+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2520

26-
#============
27-
# GeckoDriver
28-
#============
29-
ARG GECKODRIVER_VERSION=latest
30-
RUN GK_VERSION=$(if [ ${GECKODRIVER_VERSION:-latest} = "latest" ]; then echo "0.30.0"; else echo $GECKODRIVER_VERSION; fi) \
31-
&& echo "Using GeckoDriver version: "$GK_VERSION \
32-
&& wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GK_VERSION/geckodriver-v$GK_VERSION-linux64.tar.gz \
33-
&& rm -rf /opt/geckodriver \
34-
&& tar -C /opt -zxf /tmp/geckodriver.tar.gz \
35-
&& rm /tmp/geckodriver.tar.gz \
36-
&& mv /opt/geckodriver /opt/geckodriver-$GK_VERSION \
37-
&& chmod 755 /opt/geckodriver-$GK_VERSION \
38-
&& ln -fs /opt/geckodriver-$GK_VERSION /usr/bin/geckodriver
21+
# geckodriver was built using the local-seleniarm/geckodriver-arm64 Debian image
22+
COPY geckodriver /usr/local/bin/
3923

4024
USER 1200
4125

4226
#============================================
4327
# Dumping Browser name and version for config
4428
#============================================
45-
RUN echo "firefox" > /opt/selenium/browser_name
29+
RUN echo "firefox" > /opt/selenium/browser_name

NodeFirefox/Dockerfile-geckodriver-arm64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ USER root
1111
# Debugging
1212
#===========
1313
WORKDIR /opt
14-
RUN echo "deb http://http.us.debian.org/debian/ sid main" >> /etc/apt/sources.list \
14+
RUN echo "deb http://ftp.hk.debian.org/debian/ sid main" >> /etc/apt/sources.list \
1515
&& apt-get update -qqy \
1616
&& apt install gcc build-essential git vim cargo -y \
1717
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \

NodeFirefox/Dockerfile.arm64

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM local-seleniarm/node-base:4.0.0-20211018
2-
LABEL authors=SeleniumHQ,sj26,jamesmortensen
1+
#FROM local-seleniarm/node-base:4.0.0-20211018
2+
#LABEL authors=SeleniumHQ,sj26,jamesmortensen
33

44
USER root
55

66
#=========
77
# Firefox
88
#=========
9-
RUN echo "deb http://http.us.debian.org/debian/ sid main" >> /etc/apt/sources.list \
9+
RUN echo "deb http://ftp.hk.debian.org/debian/ sid main" >> /etc/apt/sources.list \
1010
&& apt-get update -qqy \
1111
&& apt-get -qqy install firefox-esr libavcodec-extra \
1212
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
@@ -15,3 +15,8 @@ RUN echo "deb http://http.us.debian.org/debian/ sid main" >> /etc/apt/sources.li
1515
COPY geckodriver /usr/local/bin/
1616

1717
USER 1200
18+
19+
#============================================
20+
# Dumping Browser name and version for config
21+
#============================================
22+
RUN echo "firefox" > /opt/selenium/browser_name

NodeFirefox/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## Building NodeFirefox and StandaloneFirefox for ARM64
2+
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.
4+
5+
As a result, I split the build process into various steps:
6+
7+
### Step 0
8+
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.
10+
11+
```
12+
$ sh build.sh
13+
```
14+
15+
Before proceeding, verify that local-seleniarm/base:latest and local-seleniarm/node-base:latest exist by using `docker image ls`.
16+
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
31+
```
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+
35+
```
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`.
51+
52+
53+
## Running the StandaloneFirefox image
54+
55+
```
56+
$ docker run --rm -it --shm-size 3g -p 4444:4444 -p 5900:5900 -p 7900:7900 local-seleniarm/standalone-firefox:latest
57+
```
58+
59+
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-step-2.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22

3-
BUILD_DATE=$(date +'%Y%m%d')
43
DOCKERDEB=false # if using Docker Desktop, set to false
54

65
if [[ $DOCKERDEB == true ]]
@@ -12,19 +11,35 @@ else
1211
cp /media/host/geckodriver .
1312
fi
1413

14+
echo 'Generate the Dockerfile.arm64...'
15+
BUILD_DATE=$(date +'%Y%m%d')
16+
VERSION=4.0.0
17+
NAMESPACE=local-seleniarm
18+
AUTHORS=SeleniumHQ,sj26,jamesmortensen
19+
20+
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" > ./Dockerfile
21+
echo "# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED." >> ./Dockerfile
22+
echo "# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE" >> ./Dockerfile
23+
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ./Dockerfile
24+
echo FROM ${NAMESPACE}/node-base:${VERSION}-${BUILD_DATE} >> ./Dockerfile
25+
echo LABEL authors="$AUTHORS" >> ./Dockerfile
26+
echo "" >> ./Dockerfile
27+
cat ./Dockerfile.arm64 >> ./Dockerfile
28+
29+
1530

16-
echo 'Building Seleniarm/NodeFirefox:4.0.0-$BUILD_DATE'
17-
docker buildx build --platform linux/arm64 -f Dockerfile.arm64 -t local-seleniarm/node-firefox:4.0.0-$BUILD_DATE .
18-
docker tag local-seleniarm/node-firefox:4.0.0-$BUILD_DATE local-seleniarm/node-firefox:latest
31+
echo "Building Seleniarm/NodeFirefox:$VERSION-$BUILD_DATE"
32+
docker buildx build --platform linux/arm64 -f Dockerfile -t local-seleniarm/node-firefox:$VERSION-$BUILD_DATE .
33+
docker tag local-seleniarm/node-firefox:$VERSION-$BUILD_DATE local-seleniarm/node-firefox:latest
1934

2035
# Generate the Seleniarm/StandaloneFirefox Dockerfile
21-
cd ../Standalone && sh generate.sh StandaloneFirefox node-firefox 4.0.0-$BUILD_DATE local-seleniarm SeleniumHQ,sj26,james
36+
cd ../Standalone && sh generate.sh StandaloneFirefox node-firefox $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS
2237
cd ../StandaloneFirefox
2338

24-
echo 'Building Seleniarm/StandaloneFirefox:4.0.0-$BUILD_DATE'
25-
docker buildx build --platform linux/arm64 -f Dockerfile -t local-seleniarm/standalone-firefox:4.0.0-$BUILD_DATE .
26-
docker tag local-seleniarm/standalone-firefox:4.0.0-$BUILD_DATE local-seleniarm/standalone-firefox:latest
39+
echo "Building Seleniarm/StandaloneFirefox:$VERSION-$BUILD_DATE"
40+
docker buildx build --platform linux/arm64 -f Dockerfile -t local-seleniarm/standalone-firefox:$VERSION-$BUILD_DATE .
41+
docker tag local-seleniarm/standalone-firefox:$VERSION-$BUILD_DATE local-seleniarm/standalone-firefox:latest
2742

2843

2944
# Remove geckodriver image and dependencies if build is successful, since it's 4.9GB!
30-
docker image rm local-seleniarm/geckodriver-arm64:4.0.0-$BUILD_DATE
45+
docker image rm local-seleniarm/geckodriver-arm64:$VERSION-$BUILD_DATE

StandaloneFirefox/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED.
33
# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE
44
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5-
FROM local-seleniarm/node-firefox:4.0.0-20211021
6-
LABEL authors=SeleniumHQ,sj26,james
5+
FROM local-seleniarm/node-firefox:4.0.0-20211111
6+
LABEL authors=SeleniumHQ,sj26,jamesmortensen
77

88
USER 1200
99

retag-latest-images-as-today.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This script retags all of the latest images with the current date tag, in case we want to rebuild images
2+
# without rebuilding from scratch.
3+
4+
BUILD_DATE=$(date +'%Y%m%d')
5+
VERSION=4.0.0
6+
NAMESPACE=local-seleniarm
7+
8+
docker tag $NAMESPACE/base:latest $NAMESPACE/base:$VERSION-$BUILD_DATE
9+
docker tag $NAMESPACE/hub:latest $NAMESPACE/hub:$VERSION-$BUILD_DATE
10+
docker tag $NAMESPACE/node-base:latest $NAMESPACE/node-base:$VERSION-$BUILD_DATE
11+
docker tag $NAMESPACE/node-chromium:latest $NAMESPACE/node-chromium:$VERSION-$BUILD_DATE
12+
docker tag $NAMESPACE/standalone-chromium:latest $NAMESPACE/standalone-chromium:$VERSION-$BUILD_DATE
13+
14+
docker tag $NAMESPACE/node-firefox:latest $NAMESPACE/node-firefox:$VERSION-$BUILD_DATE
15+
docker tag $NAMESPACE/standalone-firefox:latest $NAMESPACE/standalone-firefox:$VERSION-$BUILD_DATE

0 commit comments

Comments
 (0)