seleniumhq-community / docker-seleniarm

Multi-Arch (arm64/armhf/amd64) Docker images for the Selenium Grid Server
https://hub.docker.com/u/seleniarm
Other
249 stars 26 forks source link

32 bit arm build #3

Closed Coliinnn closed 2 years ago

Coliinnn commented 2 years ago

Description

PR to support the build for 32-bit ARM support. See the discussion in https://github.com/SeleniumHQ/docker-selenium/issues/1076. Please note that my additions may need edits to make sure that they have no unintended consequences for the project.

Motivation and Context

To run on Raspberry Pi (4), with the 32-bit Raspbian OS.

Types of changes

Checklist

jamesmortensen commented 2 years ago

With what you have here, along with a few changes I made to derive the ARCH environment variable from --platform, I pushed multi-arch images to Docker Hub for amd64, arm64, and arm/v7 (armhf):

You can pull them from here and try them out on x86_64, arm64, and armhf platforms:

docker pull seleniarm/standalone-chromium:4.1.1-alpha-20220119

docker pull seleniarm/node-chromium:4.1.1-alpha-20220119
docker pull seleniarm/hub:4.1.1-alpha-20220119

There's a few things that I had to change.

In the Base/Dockerfile, to build multi-arch, we can check TARGETARCH and TARGETVARIANT and set ARCH based on them:

RUN if [ $TARGETARCH = "arm" ] && [ $TARGETVARIANT = "v7" ]; then \
       export ARCH=armhf ; \
    else \
       export ARCH=$TARGETARCH ; \
    fi \
    && sed -i 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' ./usr/lib/jvm/java-11-openjdk-$ARCH/conf/security/java.security

Here's a diff of the changes that I'll apply before merging into the trunk:

git diff Dockerfile
diff --cc Base/Dockerfile
index ce604e2,efa4610..0000000
--- a/Base/Dockerfile
+++ b/Base/Dockerfile
@@@ -12,12 -12,12 +12,13 @@@ LABEL authors="Selenium <selenium-devel
  #  && echo "deb http://security.ubuntu.com/ubuntu focal-security main universe\n" >> /etc/apt/sources.list

  ARG TARGETARCH
++ARG TARGETVARIANT

  # No interactive frontend during docker build
  ENV DEBIAN_FRONTEND=noninteractive \
--    DEBCONF_NONINTERACTIVE_SEEN=true \
-     ARCH=armhf
 -    ARCH=$TARGETARCH
 -RUN echo $ARCH and $TARGETARCH
++    DEBCONF_NONINTERACTIVE_SEEN=true
++
 +
  #========================
  # Miscellaneous packages
  # Includes minimal runtime used for executing non GUI Java programs
@@@ -37,7 -37,7 +38,15 @@@ RUN apt-get -qqy update 
      gnupg2 \
    && rm -rf /var/lib/apt/lists/* /var/cache/apt/* 

--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
++#===================
++
++RUN if [ $TARGETARCH = "arm" ] && [ $TARGETVARIANT = "v7" ]; then \
++       export ARCH=armhf ; \
++    else \
++       export ARCH=$TARGETARCH ; \
++    fi \
++    && 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
jamesmortensen commented 2 years ago

Changes merged and updates pushed here: https://github.com/seleniarm/docker-selenium/tree/32-bit-arm