Skip to content

Commit

Permalink
FEATURE: Add early support for aarch64 in dev env
Browse files Browse the repository at this point in the history
This patch adds some new steps to support the aarch64 architecture
on Linux.

An updated version of Rust is needed to compile the `selenium-manager`
binary as it’s not shipped with the `selenium-webdriver` gem yet.
In the same vein, Google doesn’t ship an aarch64 version of Chrome yet,
so it doesn’t make sense to install even Chromium in the image. We have
to rely on Firefox to run the system specs.
  • Loading branch information
Flink committed Jan 16, 2024
1 parent fcce137 commit 8cd089c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions image/auto_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def dev_deps()
"sed -e 's/\(db_name: discourse\)/\1_development/' ../templates/postgres.template.yml > discourse_dev/postgres.template.yml",
)
run("cp ../templates/redis.template.yml discourse_dev/redis.template.yml")
run("cp base/install-rust discourse_dev/install-rust")
end

if ARGV.length != 1
Expand Down
2 changes: 1 addition & 1 deletion image/base/install-rust
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
export RUSTUP_HOME=/usr/local/rustup
export CARGO_HOME=/usr/local/cargo
export PATH=/usr/local/cargo/bin:$PATH
export RUST_VERSION=1.68.0
export RUST_VERSION=1.75.0
export RUSTUP_VERSION=1.25.2

dpkgArch="$(dpkg --print-architecture)"
Expand Down
9 changes: 5 additions & 4 deletions image/discourse_dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,14 @@ RUN mv /shared/postgres_data /shared/postgres_data_orig
# invocations when used with a mounted volume)
ADD ensure-database /etc/runit/1.d/ensure-database

RUN 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
ADD install-rust /tmp/install-rust
ADD install-selenium /tmp/install-selenium
RUN /tmp/install-selenium

# Install & Configure MailHog (https://github.com/mailhog/MailHog)
RUN wget -qO /tmp/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.1/MailHog_linux_amd64\
&& echo "e2ed634ded49929f089b20045581955ed217672078fd86082dd7a6c67c5d09c7 /tmp/mailhog" | sha256sum -c -\
&& mv /tmp/mailhog /usr/local/bin/mailhog\
&& chmod +x /usr/local/bin/mailhog

RUN rm -rf /tmp/*
21 changes: 21 additions & 0 deletions image/discourse_dev/install-selenium
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

if [ "$(dpkg --print-architecture)" = "arm64" ]; then
apt update && apt install -y firefox-esr
cd /tmp
/tmp/install-rust
git clone --depth 1 --no-checkout https://github.com/SeleniumHQ/selenium.git
cd selenium
git sparse-checkout set rust
git checkout
cd rust
cargo build --release
cp target/release/selenium-manager /usr/local/bin
rustup self uninstall -y
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
fi

0 comments on commit 8cd089c

Please sign in to comment.