diff --git a/Base/Dockerfile b/Base/Dockerfile index 522de8fa9..36bd8802d 100644 --- a/Base/Dockerfile +++ b/Base/Dockerfile @@ -1,16 +1,19 @@ -FROM ubuntu:focal-20210416 +# FROM ubuntu:focal-20210416 +#FROM ubuntu:focal-20210827 +FROM debian:latest LABEL authors="Selenium " #================================================ # Customize sources for apt-get #================================================ -RUN echo "deb http://archive.ubuntu.com/ubuntu focal main universe\n" > /etc/apt/sources.list \ - && echo "deb http://archive.ubuntu.com/ubuntu focal-updates main universe\n" >> /etc/apt/sources.list \ - && echo "deb http://security.ubuntu.com/ubuntu focal-security main universe\n" >> /etc/apt/sources.list +#RUN echo "deb http://archive.ubuntu.com/ubuntu focal main universe\n" > /etc/apt/sources.list \ +# && echo "deb http://archive.ubuntu.com/ubuntu focal-updates main universe\n" >> /etc/apt/sources.list \ +# && echo "deb http://security.ubuntu.com/ubuntu focal-security main universe\n" >> /etc/apt/sources.list # No interactive frontend during docker build ENV DEBIAN_FRONTEND=noninteractive \ - DEBCONF_NONINTERACTIVE_SEEN=true + DEBCONF_NONINTERACTIVE_SEEN=true \ + ARCH=arm64 #======================== # Miscellaneous packages @@ -30,7 +33,7 @@ RUN apt-get -qqy update \ supervisor \ gnupg2 \ && rm -rf /var/lib/apt/lists/* /var/cache/apt/* \ - && sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-11-openjdk-amd64/conf/security/java.security + && sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-11-openjdk-$ARCH/conf/security/java.security #=================== # Timezone settings diff --git a/Hub/Dockerfile b/Hub/Dockerfile index de369343c..985b582d9 100644 --- a/Hub/Dockerfile +++ b/Hub/Dockerfile @@ -2,8 +2,8 @@ # NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED. # PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -FROM selenium/base:4.0.0-20211025 -LABEL authors=SeleniumHQ +FROM local-seleniarm/base:4.0.0-20211110 +LABEL authors=SeleniumHQ,sj26,jamesmortensen USER 1200 diff --git a/NodeBase/Dockerfile b/NodeBase/Dockerfile index 481a2967d..abb661c15 100644 --- a/NodeBase/Dockerfile +++ b/NodeBase/Dockerfile @@ -2,8 +2,8 @@ # NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED. # PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -FROM selenium/base:4.0.0-20211025 -LABEL authors=SeleniumHQ +FROM local-seleniarm/base:4.0.0-20211110 +LABEL authors=SeleniumHQ,sj26,jamesmortensen USER root @@ -28,7 +28,7 @@ ENV LANG ${LANGUAGE} # Layer size: small: ~9 MB MB (with --no-install-recommends) RUN apt-get -qqy update \ && apt-get -qqy --no-install-recommends install \ - language-pack-en \ + #language-pack-en \ tzdata \ locales \ && locale-gen ${LANGUAGE} \ @@ -84,7 +84,7 @@ RUN apt-get -qqy update \ fonts-ipafont-gothic \ fonts-wqy-zenhei \ fonts-tlwg-loma-otf \ - ttf-ubuntu-font-family \ + # ttf-ubuntu-font-family \ && rm -rf /var/lib/apt/lists/* \ && apt-get -qyy clean diff --git a/NodeBase/Dockerfile.txt b/NodeBase/Dockerfile.txt index 30842dec8..56a3a13fb 100644 --- a/NodeBase/Dockerfile.txt +++ b/NodeBase/Dockerfile.txt @@ -21,7 +21,7 @@ ENV LANG ${LANGUAGE} # Layer size: small: ~9 MB MB (with --no-install-recommends) RUN apt-get -qqy update \ && apt-get -qqy --no-install-recommends install \ - language-pack-en \ + #language-pack-en \ tzdata \ locales \ && locale-gen ${LANGUAGE} \ @@ -77,7 +77,7 @@ RUN apt-get -qqy update \ fonts-ipafont-gothic \ fonts-wqy-zenhei \ fonts-tlwg-loma-otf \ - ttf-ubuntu-font-family \ + # ttf-ubuntu-font-family \ && rm -rf /var/lib/apt/lists/* \ && apt-get -qyy clean diff --git a/NodeChromium/Dockerfile b/NodeChromium/Dockerfile new file mode 100644 index 000000000..5dcd420d6 --- /dev/null +++ b/NodeChromium/Dockerfile @@ -0,0 +1,35 @@ +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED. +# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +FROM local-seleniarm/node-base:4.0.0-20211110 +LABEL authors=SeleniumHQ,sj26,jamesmortensen + +USER root + +# Install Chromium Arm64 +# RUN echo "deb http://http.us.debian.org/debian/ stable non-free contrib main" >> /etc/apt/sources.list \ +RUN echo "deb http://ftp.hk.debian.org/debian/ sid main" >> /etc/apt/sources.list \ + && apt-get update -qqy \ + # && apt-get -qqy install chromium=89.0.4389.82-1 \ + # && apt-get -qqy install chromium=90.0.4430.212-1 \ + && apt-get -qqy install chromium=93.0.4577.82-1 \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +#================================= +# Chromium Launch Script Wrapper +#================================= +COPY wrap_chromium_binary /opt/bin/wrap_chromium_binary +RUN /opt/bin/wrap_chromium_binary + +#============================================ +# Chromium webdriver +#============================================ +RUN apt-get update -qqy \ + && apt-get -qqy install chromium-driver \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +RUN echo "chrome" > /opt/selenium/browser_name + +USER 1200 + diff --git a/NodeChromium/Dockerfile.txt b/NodeChromium/Dockerfile.txt new file mode 100644 index 000000000..6a8da6fff --- /dev/null +++ b/NodeChromium/Dockerfile.txt @@ -0,0 +1,28 @@ +USER root + +# Install Chromium Arm64 +# RUN echo "deb http://http.us.debian.org/debian/ stable non-free contrib main" >> /etc/apt/sources.list \ +RUN echo "deb http://ftp.hk.debian.org/debian/ sid main" >> /etc/apt/sources.list \ + && apt-get update -qqy \ + # && apt-get -qqy install chromium=89.0.4389.82-1 \ + # && apt-get -qqy install chromium=90.0.4430.212-1 \ + && apt-get -qqy install chromium=93.0.4577.82-1 \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +#================================= +# Chromium Launch Script Wrapper +#================================= +COPY wrap_chromium_binary /opt/bin/wrap_chromium_binary +RUN /opt/bin/wrap_chromium_binary + +#============================================ +# Chromium webdriver +#============================================ +RUN apt-get update -qqy \ + && apt-get -qqy install chromium-driver \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +RUN echo "chrome" > /opt/selenium/browser_name + +USER 1200 + diff --git a/NodeChromium/Dockerfile.ubuntubad b/NodeChromium/Dockerfile.ubuntubad new file mode 100644 index 000000000..dc8a4b588 --- /dev/null +++ b/NodeChromium/Dockerfile.ubuntubad @@ -0,0 +1,38 @@ +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED. +# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +FROM local-seleniarm/node-base:4.0.0-rc-2-prerelease-20210930 +LABEL authors=james + +USER root + +RUN apt-get update && apt-get install curl wget \ + && curl http://ftp.cn.debian.org/debian/pool/main/c/chromium/chromium_90.0.4430.212-1_arm64.deb -o chromium.deb + +RUN ls chromium.deb && apt install -f ./chromium.deb + +# Install Chromium Arm64 +#RUN echo "deb http://http.us.debian.org/debian/ testing non-free contrib main" >> /etc/apt/sources.list \ +#RUN +# && apt-get update -qqy \ + # && apt-get -qqy install chromium=89.0.4389.82-1 \ +# && apt-get -qqy install chromium=94.0.4606.54 \ +# && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +#================================= +# Chromium Launch Script Wrapper +#================================= +COPY wrap_chromium_binary /opt/bin/wrap_chromium_binary +RUN /opt/bin/wrap_chromium_binary + +#============================================ +# Chromium webdriver +#============================================ +RUN apt-get update -qqy \ + && apt-get -qqy install chromium-driver \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* + + +USER 1200 + diff --git a/NodeChromium/generate.sh b/NodeChromium/generate.sh new file mode 100755 index 000000000..8267ce323 --- /dev/null +++ b/NodeChromium/generate.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +VERSION=$1 +NAMESPACE=$2 +AUTHORS=$3 + +echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" > ./Dockerfile +echo "# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED." >> ./Dockerfile +echo "# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE" >> ./Dockerfile +echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >> ./Dockerfile +echo FROM ${NAMESPACE}/node-base:${VERSION} >> ./Dockerfile +echo LABEL authors="$AUTHORS" >> ./Dockerfile +echo "" >> ./Dockerfile +cat ./Dockerfile.txt >> ./Dockerfile diff --git a/NodeChromium/wrap_chromium_binary b/NodeChromium/wrap_chromium_binary new file mode 100755 index 000000000..0d5947cad --- /dev/null +++ b/NodeChromium/wrap_chromium_binary @@ -0,0 +1,12 @@ +#!/bin/bash + +WRAPPER_PATH=$(readlink -f /usr/bin/chromium) +BASE_PATH="$WRAPPER_PATH-base" +mv "$WRAPPER_PATH" "$BASE_PATH" + +cat > "$WRAPPER_PATH" <<_EOF +#!/bin/bash +# Note: exec -a below is a bashism. +exec -a "\$0" "$BASE_PATH" --no-sandbox "\$@" +_EOF +chmod +x "$WRAPPER_PATH" diff --git a/README.md b/README.md index 8e9f8cf69..4fd5af272 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,40 @@ +# Docker images for Selenium, built for Debian ARM64 + +At this point, I've only updated the images for Chromium 93, the latest ARM64 build for Debian ARM64. + +## Only Building the Images + +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. + +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. + +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. + +To build the images, run build.sh from the root directory of this repo: + +``` +$ sh build.sh +``` + +I have not pushed any images to the Docker registry. If you wish to push them to a registry, you may do so. For more information on older ARM64 Selenium images, see https://github.com/sj26/docker-selenium and https://hub.docker.com/u/seleniarm + +the primary motivation for creating this fork and updating the images is so I can use the noVNC client on Selenium 4.0.0. To use noVNC, make sure you open port 7900, and visit localhost:7900 in your browser. + +To start the container image, run: + +``` +$ docker run --rm -it -p 4444:4444 -p 5900:5900 -p 7900:7900 --shm-size 3g local-seleniarm/standalone-chromium:latest +``` + +Use your traditional VNC client via port 5900, and noVNC in the browser via port 7900. + + +---- +The official documentation from seleniumHQ begins here: +---- + + # Docker images for the Selenium Grid Server The project is made possible by volunteer contributors who have put in thousands of hours of their own time, diff --git a/StandaloneChromium/Dockerfile b/StandaloneChromium/Dockerfile new file mode 100644 index 000000000..8a86850d9 --- /dev/null +++ b/StandaloneChromium/Dockerfile @@ -0,0 +1,28 @@ +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED. +# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +FROM local-seleniarm/node-chromium:4.0.0-20211110 +LABEL authors=SeleniumHQ,sj26,jamesmortensen + +USER 1200 + +#==================================== +# Scripts to run Selenium Standalone +#==================================== +COPY start-selenium-standalone.sh /opt/bin/start-selenium-standalone.sh + +#============================== +# Supervisor configuration file +#============================== +COPY selenium.conf /etc/supervisor/conf.d/ + +# Copying configuration script generator +COPY generate_config /opt/bin/generate_config + +# Boolean value, maps "--relax-checks" +ENV SE_RELAX_CHECKS true + +EXPOSE 4444 + + diff --git a/build-amd64.sh b/build-amd64.sh new file mode 100644 index 000000000..0d79aa974 --- /dev/null +++ b/build-amd64.sh @@ -0,0 +1,30 @@ +BUILD_DATE=$(date +'%Y%m%d') +VERSION=4.0.0-beta-2 +CHROMIUM=91.0.4472.124 +NAMESPACE=local-selenium +AUTHORS=james + +cd ./Base && docker buildx build --platform linux/amd64 -t $NAMESPACE/base:$VERSION-$BUILD_DATE . +echo $PWD +cd ../Hub && sh generate.sh $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && docker buildx build --platform linux/amd64 -t $NAMESPACE/hub:$VERSION-$BUILD_DATE . + +cd ../NodeBase && sh generate.sh $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && docker buildx build --platform linux/amd64 -t $NAMESPACE/node-base:$VERSION-$BUILD_DATE . +# && sed 's/chromium=.*/chromium=91.0.4472.124/' Dockerfile > Dockerfile \ +cd ../NodeChromium && sh generate.sh $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && docker buildx build --platform linux/amd64 -t $NAMESPACE/node-chromium:$VERSION-$BUILD_DATE . + +cd ../Standalone && sh generate.sh StandaloneChromium node-chromium $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && cd ../StandaloneChromium \ + && docker buildx build --platform linux/amd64 -t $NAMESPACE/standalone-chromium:$VERSION-$BUILD_DATE . + +echo "Build node-hub, node-chromium, and standalone-chromium...\n" +echo "Tagging builds...\n" + +docker tag $NAMESPACE/base:$VERSION-$BUILD_DATE $NAMESPACE/base:latest +docker tag $NAMESPACE/hub:$VERSION-$BUILD_DATE $NAMESPACE/hub:latest +docker tag $NAMESPACE/node-base:$VERSION-$BUILD_DATE $NAMESPACE/node-base:latest +docker tag $NAMESPACE/node-chromium:$VERSION-$BUILD_DATE $NAMESPACE/node-chromium:latest +docker tag $NAMESPACE/standalone-chromium:$VERSION-$BUILD_DATE $NAMESPACE/standalone-chromium:latest + diff --git a/build.sh b/build.sh new file mode 100644 index 000000000..4d3627cc8 --- /dev/null +++ b/build.sh @@ -0,0 +1,30 @@ +BUILD_DATE=$(date +'%Y%m%d') +VERSION=4.0.0 +CHROMIUM=93.0.4577.82 # Not yet used at this time. Edit in NodeChromium/Dockerfile.txt +NAMESPACE=local-seleniarm +AUTHORS=SeleniumHQ,sj26,jamesmortensen + +cd ./Base && docker buildx build --platform linux/arm64 -t $NAMESPACE/base:$VERSION-$BUILD_DATE . +echo $PWD +cd ../Hub && sh generate.sh $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && docker buildx build --platform linux/arm64 -t $NAMESPACE/hub:$VERSION-$BUILD_DATE . + +cd ../NodeBase && sh generate.sh $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && docker buildx build --platform linux/arm64 -t $NAMESPACE/node-base:$VERSION-$BUILD_DATE . +# && sed 's/chromium=.*/chromium=91.0.4472.124/' Dockerfile > Dockerfile \ +cd ../NodeChromium && sh generate.sh $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && docker buildx build --platform linux/arm64 -t $NAMESPACE/node-chromium:$VERSION-$BUILD_DATE . + +cd ../Standalone && sh generate.sh StandaloneChromium node-chromium $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS \ + && cd ../StandaloneChromium \ + && docker buildx build --platform linux/arm64 -t $NAMESPACE/standalone-chromium:$VERSION-$BUILD_DATE . + +echo "Build node-hub, node-chromium, and standalone-chromium...\n" +echo "Tagging builds...\n" + +docker tag $NAMESPACE/base:$VERSION-$BUILD_DATE $NAMESPACE/base:latest +docker tag $NAMESPACE/hub:$VERSION-$BUILD_DATE $NAMESPACE/hub:latest +docker tag $NAMESPACE/node-base:$VERSION-$BUILD_DATE $NAMESPACE/node-base:latest +docker tag $NAMESPACE/node-chromium:$VERSION-$BUILD_DATE $NAMESPACE/node-chromium:latest +docker tag $NAMESPACE/standalone-chromium:$VERSION-$BUILD_DATE $NAMESPACE/standalone-chromium:latest +