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

Commit e097012

Browse files
Made changes to Dockerfiles to support multi-arch building. This involved modifying NodeBase Dockerfile so that sudo is not used, since there were suid permission errors appearing. Multi-arch images pushed for base, node-base, hub, node-chromium, and standalone-chromium only as tag 4.1.0-alpha-20211218
1 parent 777f23d commit e097012

File tree

12 files changed

+89
-31
lines changed

12 files changed

+89
-31
lines changed

Base/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ LABEL authors="Selenium <[email protected]>"
1111
# && echo "deb http://archive.ubuntu.com/ubuntu focal-updates main universe\n" >> /etc/apt/sources.list \
1212
# && echo "deb http://security.ubuntu.com/ubuntu focal-security main universe\n" >> /etc/apt/sources.list
1313

14+
ARG TARGETARCH
15+
1416
# No interactive frontend during docker build
1517
ENV DEBIAN_FRONTEND=noninteractive \
1618
DEBCONF_NONINTERACTIVE_SEEN=true \
17-
ARCH=arm64
19+
ARCH=$TARGETARCH
1820

1921
#========================
2022
# Miscellaneous packages
@@ -33,8 +35,9 @@ RUN apt-get -qqy update \
3335
curl \
3436
supervisor \
3537
gnupg2 \
36-
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
37-
&& sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-11-openjdk-$ARCH/conf/security/java.security
38+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
39+
40+
RUN echo $ARCH && sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-11-openjdk-$ARCH/conf/security/java.security
3841

3942
#===================
4043
# Timezone settings

Hub/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED.
33
# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE
44
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5-
FROM local-seleniarm/base:4.1.0-20211217
5+
FROM seleniarm/base:4.1.0-alpha-20211218
66
LABEL authors=SeleniumHQ,sj26,jamesmortensen
77

88
USER 1200

NodeBase/Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# NOTE: DO *NOT* EDIT THIS FILE. IT IS GENERATED.
33
# PLEASE UPDATE Dockerfile.txt INSTEAD OF THIS FILE
44
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5-
FROM local-seleniarm/base:4.1.0-20211217
5+
FROM seleniarm/base:4.1.0-alpha-20211218
66
LABEL authors=SeleniumHQ,sj26,jamesmortensen
77

88
USER root
@@ -139,13 +139,15 @@ COPY selenium.conf /etc/supervisor/conf.d/
139139
RUN mkdir -p ${HOME}/.vnc \
140140
&& x11vnc -storepasswd secret ${HOME}/.vnc/passwd
141141

142+
USER root
142143
#==========
143144
# Relaxing permissions for OpenShift and other non-sudo environments
144145
#==========
145-
RUN sudo chmod -R 777 ${HOME} \
146-
&& sudo chgrp -R 0 ${HOME} \
147-
&& sudo chmod -R g=u ${HOME}
146+
RUN chmod -R 777 ${HOME} \
147+
&& chgrp -R 0 ${HOME} \
148+
&& chmod -R g=u ${HOME}
148149

150+
USER 1200
149151
#==============================
150152
# Scripts to run fluxbox, x11vnc and noVNC
151153
#==============================
@@ -186,8 +188,11 @@ ENV SE_NODE_OVERRIDE_MAX_SESSIONS false
186188
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
187189
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
188190

191+
USER root
189192
# Creating base directory for Xvfb
190-
RUN sudo mkdir -p /tmp/.X11-unix && sudo chmod 1777 /tmp/.X11-unix
193+
RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
194+
195+
USER 1200
191196

192197
# Copying configuration script generator
193198
COPY generate_config /opt/bin/generate_config

NodeBase/Dockerfile.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,20 @@ COPY selenium.conf /etc/supervisor/conf.d/
132132
RUN mkdir -p ${HOME}/.vnc \
133133
&& x11vnc -storepasswd secret ${HOME}/.vnc/passwd
134134

135+
# Added to avoid the following sudo error while running multi-arch builds:
136+
# "sudo: effective uid is not 0, is /usr/bin/sudo on a file system with
137+
# the 'nosuid' option set or an NFS file system without root privileges?"
138+
USER root
139+
135140
#==========
136141
# Relaxing permissions for OpenShift and other non-sudo environments
137142
#==========
138-
RUN sudo chmod -R 777 ${HOME} \
139-
&& sudo chgrp -R 0 ${HOME} \
140-
&& sudo chmod -R g=u ${HOME}
143+
RUN chmod -R 777 ${HOME} \
144+
&& chgrp -R 0 ${HOME} \
145+
&& chmod -R g=u ${HOME}
146+
147+
# Added to avoid sudo-related multi-arch build errors
148+
USER 1200
141149

142150
#==============================
143151
# Scripts to run fluxbox, x11vnc and noVNC
@@ -179,8 +187,14 @@ ENV SE_NODE_OVERRIDE_MAX_SESSIONS false
179187
# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
180188
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
181189

190+
# Added to avoid sudo-related multi-arch build errors
191+
USER root
192+
182193
# Creating base directory for Xvfb
183-
RUN sudo mkdir -p /tmp/.X11-unix && sudo chmod 1777 /tmp/.X11-unix
194+
RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix
195+
196+
# Added to avoid sudo-related multi-arch build errors
197+
USER 1200
184198

185199
# Copying configuration script generator
186200
COPY generate_config /opt/bin/generate_config

NodeChromium/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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-base:4.1.0-20211217
5+
FROM seleniarm/node-base:4.1.0-alpha-20211218
66
LABEL authors=SeleniumHQ,sj26,jamesmortensen
77

88
USER root

NodeFirefox/Dockerfile-geckodriver-arm64

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ USER root
1313
WORKDIR /opt
1414
RUN echo "deb http://ftp.hk.debian.org/debian/ sid main" >> /etc/apt/sources.list \
1515
&& apt-get update -qqy \
16-
&& apt install gcc build-essential git vim cargo -y \
16+
&& apt install gcc build-essential git vim cargo --no-install-recommends -y \
1717
&& curl https://sh.rustup.rs -sSf | bash -s -- -y \
1818
&& git clone https://github.com/mozilla/geckodriver.git && cd geckodriver \
19-
&& git checkout v0.30.0
19+
&& git checkout v0.30.0 \
20+
&& apt-get autoremove && apt-get clean \
21+
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
2022

2123
RUN echo "alias l='ls -ltrSha'" >> /home/seluser/.bashrc
2224

NodeFirefox/build-step-1.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/bash
22

3+
ARCH=linux/amd64
34
BUILD_DATE=$(date +'%Y%m%d')
45
# Make sure other images are built first using build.sh
56
# We need both the Base and NodeBase to begin building NodeFirefox
67

78
# 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+
docker buildx build --platform $ARCH -f Dockerfile-geckodriver-arm64 -t local-seleniarm/geckodriver-binary:$BUILD_DATE .
910

1011
# build geckodriver binary and copy to build folder on host
1112
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+
docker run --rm -it -v $PWD:/media/host -w /opt/geckodriver --name geckodriver-binary local-seleniarm/geckodriver-binary:$BUILD_DATE bash
1314

1415

1516
echo 'After exiting, run build-step-2.sh'

NodeFirefox/build-step-2.sh

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

33
DOCKERDEB=false # if using Docker Desktop, set to false
4+
ARCH=linux/amd64
45

56
if [[ $DOCKERDEB == true ]]
67
then
@@ -29,15 +30,15 @@ cat ./Dockerfile.arm64 >> ./Dockerfile
2930

3031

3132
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 buildx build --platform $ARCH -f Dockerfile -t local-seleniarm/node-firefox:$VERSION-$BUILD_DATE .
3334
docker tag local-seleniarm/node-firefox:$VERSION-$BUILD_DATE local-seleniarm/node-firefox:latest
3435

3536
# Generate the Seleniarm/StandaloneFirefox Dockerfile
3637
cd ../Standalone && sh generate.sh StandaloneFirefox node-firefox $VERSION-$BUILD_DATE $NAMESPACE $AUTHORS
3738
cd ../StandaloneFirefox
3839

3940
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 buildx build --platform $ARCH -f Dockerfile -t local-seleniarm/standalone-firefox:$VERSION-$BUILD_DATE .
4142
docker tag local-seleniarm/standalone-firefox:$VERSION-$BUILD_DATE local-seleniarm/standalone-firefox:latest
4243

4344

StandaloneChromium/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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-chromium:4.1.0-20211217
5+
FROM seleniarm/node-chromium:4.1.0-alpha-20211218
66
LABEL authors=SeleniumHQ,sj26,jamesmortensen
77

88
USER 1200

build-amd64.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
BUILD_DATE=$(date +'%Y%m%d')
2-
VERSION=4.0.0-beta-2
2+
VERSION=4.1.0
33
CHROMIUM=91.0.4472.124
44
NAMESPACE=local-selenium
5-
AUTHORS=james
5+
AUTHORS=SeleniumHQ,sj26,jamesmortensen
66

77
cd ./Base && docker buildx build --platform linux/amd64 -t $NAMESPACE/base:$VERSION-$BUILD_DATE .
88
echo $PWD

0 commit comments

Comments
 (0)