From 961a4a13cae053eb1cbe5d117b1eb740410fb06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Thu, 21 Mar 2024 16:27:02 +0100 Subject: [PATCH] Add Chromium to our images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- image/discourse_dev/install-selenium | 9 +++------ image/discourse_test/Dockerfile | 2 +- image/discourse_test/install-chrome | 16 +++++----------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/image/discourse_dev/install-selenium b/image/discourse_dev/install-selenium index 2cf6f74..ff3cbb2 100755 --- a/image/discourse_dev/install-selenium +++ b/image/discourse_dev/install-selenium @@ -1,13 +1,10 @@ #!/bin/bash set -e -# The chrome webdriver isn’t available for the aarch64 architecture (yet). We -# have to rely on the geckodriver instead, so we’re just installing firefox and -# not even chromium. # The Selenium gem isn’t 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 diff --git a/image/discourse_test/Dockerfile b/image/discourse_test/Dockerfile index 3558705..6d8fe78 100644 --- a/image/discourse_test/Dockerfile +++ b/image/discourse_test/Dockerfile @@ -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"] \ No newline at end of file +ENTRYPOINT ["sudo", "-E", "-u", "discourse", "-H", "ruby", "script/docker_test.rb"] diff --git a/image/discourse_test/install-chrome b/image/discourse_test/install-chrome index b6e559e..8b9d24a 100755 --- a/image/discourse_test/install-chrome +++ b/image/discourse_test/install-chrome @@ -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