Add Chromium to our images

Chrome isn’t available for aarch64 yet, but Chromium (which is basically
the same browser without the proprietary bits from Google) is shipped by
Debian. They also ship a Chrome driver compiled for aarch64.

This patch adds Chromium to our images without removing Chrome on
x86_64, allowing a smooth transition to using Chromium only.
This commit is contained in:
Loïc Guitaut 2024-03-21 16:27:02 +01:00 committed by Loïc Guitaut
parent 5bbffa83bd
commit 961a4a13ca
3 changed files with 9 additions and 18 deletions

View File

@ -1,13 +1,10 @@
#!/bin/bash
set -e
# The chrome webdriver isnt available for the aarch64 architecture (yet). We
# have to rely on the geckodriver instead, so were just installing firefox and
# not even chromium.
# The Selenium gem isnt shipped with the `selenium-manager` binary for aarch64
# either (yet). So we have to compile it ourselves.
# (yet). So we have to compile it ourselves.
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
apt update && apt install -y firefox-esr
apt update && apt install -y firefox-esr chromium-driver
cd /tmp
/tmp/install-rust
git clone --depth 1 --no-checkout https://github.com/SeleniumHQ/selenium.git
@ -24,5 +21,5 @@ else
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - &&\
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list &&\
apt update &&\
apt install -y google-chrome-stable firefox-esr
apt install -y google-chrome-stable firefox-esr chromium-driver
fi

View File

@ -36,4 +36,4 @@ RUN cd /var/www/discourse && sudo -E -u discourse -H bundle exec rake plugin:ins
LOAD_PLUGINS=1 sudo -E -u discourse -H bundle exec rake plugin:install_all_gems &&\
sudo -E -u discourse -H bundle exec ruby script/install_minio_binaries.rb
ENTRYPOINT ["sudo", "-E", "-u", "discourse", "-H", "ruby", "script/docker_test.rb"]
ENTRYPOINT ["sudo", "-E", "-u", "discourse", "-H", "ruby", "script/docker_test.rb"]

View File

@ -1,20 +1,14 @@
#!/bin/bash
set -e
# https://googlechromelabs.github.io/chrome-for-testing/ doesn't provide linux/arm64 binaries for chrome or chromedriver
# yet. Therefore on arm64, we install chromium instead of chrome and install a chromedriver for linux/arm64 from
# https://github.com/electron/electron/releases/.
#
# On the current debian Chromium 120.0.6099.224 is installed so we have to install a chromedriver that is of the same version.
# https://googlechromelabs.github.io/chrome-for-testing/ doesn't provide
# linux/arm64 binaries for chrome or chromedriver yet. Therefore on arm64, we
# install chromium instead of chrome.
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
apt update && apt install -y chromium unzip &&\
wget -q -O /tmp/chromedriver.zip https://github.com/electron/electron/releases/download/v28.2.2/chromedriver-v28.2.2-linux-arm64.zip &&\
unzip /tmp/chromedriver.zip -d /tmp/chromedriver &&\
mv /tmp/chromedriver/chromedriver /usr/bin &&\
rm -rf /tmp/chromedriver /tmp/chromedriver.zip
apt update && apt install -y chromium-driver
else
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - &&\
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list &&\
apt update &&\
apt install -y google-chrome-stable
apt install -y google-chrome-stable chromium-driver
fi