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

32 bit arm build #3

Merged
merged 7 commits into from
Jan 19, 2022

Conversation

Coliinnn
Copy link

Description

PR to support the build for 32-bit ARM support. See the discussion in SeleniumHQ#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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Requires 'linux/arm/v7' in build.sh
Requires 'armhf' in Base/Dockerfile
I wasn't sure where 'TARGETARCH' gets it values, so in my local instance I removed the variable and hard-coded the correct value to make it build successfully.
Only version 97 supports 32-bit ARM
@jamesmortensen jamesmortensen changed the base branch from trunk to 32-bit-arm January 19, 2022 12:59
@jamesmortensen
Copy link

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 jamesmortensen merged commit 8d7241d into seleniumhq-community:32-bit-arm Jan 19, 2022
@jamesmortensen
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants