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

Commit d62f6cf

Browse files
Added intermediate Dockerfile-geckodriver-arm64 to setup Linux environment to build geckodriver by running build-geckodriver-arm64.sh within that container and then copying it to a shared volume on the host. Then Dockerfile.arm64 picks up from where NodeBase left off to build both the NodeFirefox and StandaloneFirefox by copying in the geckodriver binary.
1 parent f0fe1dc commit d62f6cf

File tree

6 files changed

+114
-2
lines changed

6 files changed

+114
-2
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM local-seleniarm/node-base:latest
2+
LABEL authors=SeleniumHQ,sj26,jamesmortensen
3+
4+
##### tags
5+
# local-seleniarm/geckodriver-arm64:4.0.0-$(build_date)
6+
#####
7+
USER root
8+
9+
10+
#===========
11+
# Debugging
12+
#===========
13+
WORKDIR /opt
14+
RUN echo "deb http://http.us.debian.org/debian/ sid main" >> /etc/apt/sources.list \
15+
&& apt-get update -qqy \
16+
&& apt install gcc build-essential git vim cargo -y \
17+
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \
18+
&& git clone https://github.com/mozilla/geckodriver.git && cd geckodriver \
19+
&& git checkout v0.30.0
20+
21+
RUN echo "alias l='ls -ltrSha'" >> /home/seluser/.bashrc
22+
23+
COPY build-geckodriver-arm64.sh /opt/geckodriver/
24+
25+
RUN chown seluser /opt/geckodriver/build-geckodriver-arm64.sh \
26+
&& chmod 755 /opt/geckodriver/build-geckodriver-arm64.sh \
27+
&& sudo chown -R seluser /home/seluser/.rustup /home/seluser/.cargo /opt/geckodriver
28+
29+
# COPY geckodriver /usr/local/bin/
30+
# USER seluser
31+
# RUN sudo chown -R seluser /home/seluser/.rustup /home/seluser/.cargo /opt/geckodriver \
32+
# && cd /opt/geckodriver \
33+
# && cargo build \
34+
# && sudo cp target/debug/geckodriver /usr/local/bin/ \
35+
# && sudo apt remove gcc build-essential cargo
36+
37+
# WORKDIR /
38+
39+
#============
40+
# GeckoDriver
41+
#============
42+
# For arm64 we're sniffing a compatible binary out of an ubuntu package, don't look too hard!
43+
#RUN echo "Downloading Arm64 geckodriver..."
44+
# curl http://ports.ubuntu.com/pool/universe/f/firefox/firefox-geckodriver_75.0+build3-0ubuntu1_arm64.deb | dpkg-deb --fsys-tarfile - | tar -C / -x ./usr/bin/geckodriver;
45+
# curl http://ports.ubuntu.com/pool/universe/f/firefox/firefox-geckodriver_93.0+build1-0ubuntu3_arm64.deb | dpkg-deb --fsys-tarfile - | tar -C / -x ./usr/bin/geckodriver;
46+
47+
USER 1200

NodeFirefox/Dockerfile.arm64

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM local-seleniarm/node-base:4.0.0-20211018
2+
LABEL authors=SeleniumHQ,sj26,jamesmortensen
3+
4+
USER root
5+
6+
#=========
7+
# Firefox
8+
#=========
9+
RUN echo "deb http://http.us.debian.org/debian/ sid main" >> /etc/apt/sources.list \
10+
&& apt-get update -qqy \
11+
&& apt-get -qqy install firefox-esr libavcodec-extra \
12+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
13+
14+
# geckodriver was built using the local-seleniarm/geckodriver-arm64 Debian image
15+
COPY geckodriver /usr/local/bin/
16+
17+
USER 1200
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
cargo build && sudo cp /opt/geckodriver/target/debug/geckodriver /media/host

NodeFirefox/build-step-1.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
BUILD_DATE=$(date +'%Y%m%d')
4+
# Make sure other images are built first using build.sh
5+
# We need both the Base and NodeBase to begin building NodeFirefox
6+
7+
# Install geckodriver binary dependencies
8+
docker buildx build --platform linux/arm64 -f Dockerfile-geckodriver-arm64 -t local-seleniarm/geckodriver-arm64:4.0.0-$BUILD_DATE .
9+
10+
# build geckodriver binary and copy to build folder on host
11+
echo 'Building geckodriver must be done manually from within an intermediate container. Run ./build-geckodriver-arm64.sh on the container, then exit...'
12+
docker run --rm -it -v $PWD:/media/host -w /opt/geckodriver --name geckodriver-arm64 local-seleniarm/geckodriver-arm64:4.0.0-$BUILD_DATE bash
13+
14+
15+
echo 'After exiting, run build-step-2.sh'

NodeFirefox/build-step-2.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
BUILD_DATE=$(date +'%Y%m%d')
4+
DOCKERDEB=false # if using Docker Desktop, set to false
5+
6+
if [[ $DOCKERDEB == true ]]
7+
then
8+
echo 'Getting geckodriver binary from the Docker Debian VM...'
9+
sh get-geckodriver.sh
10+
else
11+
echo 'Getting geckodriver from /media/host...'
12+
cp /media/host/geckodriver .
13+
fi
14+
15+
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
19+
20+
# Generate the Seleniarm/StandaloneFirefox Dockerfile
21+
cd ../Standalone && sh generate.sh StandaloneFirefox node-firefox 4.0.0-$BUILD_DATE local-seleniarm SeleniumHQ,sj26,james
22+
cd ../StandaloneFirefox
23+
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
27+
28+
29+
# 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

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 selenium/node-firefox:4.0.0-20211013
6-
LABEL authors=SeleniumHQ
5+
FROM local-seleniarm/node-firefox:4.0.0-20211021
6+
LABEL authors=SeleniumHQ,sj26,james
77

88
USER 1200
99

0 commit comments

Comments
 (0)