11#! /usr/bin/env bash
22#
3- # Installs mise system-wide and pre-installs the sentry-ruby toolchain (Java,
4- # Ruby, Node) plus a headless Chromium, all baked into the image so the
5- # container starts without downloading anything at runtime.
3+ # Installs mise, the sentry-ruby toolchain, and Chromium with ChromeDriver.
64#
75set -euo pipefail
86
97RUBY_VERSION=" ${RUBYVERSION:- latest} "
108USERNAME=" ${_REMOTE_USER:- sentry} "
119USER_HOME=" ${_REMOTE_USER_HOME:-/ home/ ${USERNAME} } "
1210
11+ echo " 📦 Installing Chromium and ChromeDriver..."
12+ echo " deb http://deb.debian.org/debian sid main" > /etc/apt/sources.list.d/debian.list
13+ wget -qO- https://ftp-master.debian.org/keys/archive-key-12.asc \
14+ | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-keyring.gpg
15+ wget -qO- https://ftp-master.debian.org/keys/archive-key-12-security.asc \
16+ | gpg --dearmor > /etc/apt/trusted.gpg.d/debian-archive-security-keyring.gpg
17+ for directory in bin lib lib32 lib64 libo32 libx32 sbin; do
18+ dpkg-divert --package base-files --no-rename --remove " /${directory} "
19+ done
20+ apt-get update
21+ apt-get install -y --no-install-recommends chromium chromium-driver
22+ rm -rf /var/lib/apt/lists/* /var/cache/apt/* /etc/apt/sources.list.d/debian.list
23+
1324# Install mise system-wide via the official installer. This downloads a prebuilt
1425# binary from mise's CDN rather than the GitHub API, avoiding the API rate
1526# limits the gh-release-based community feature hits on shared CI runners.
@@ -24,38 +35,15 @@ echo "eval \"\$(${MISE_BIN} activate bash)\"" >> "${USER_HOME}/.bashrc"
2435echo " eval \"\$ (${MISE_BIN} activate zsh)\" " >> " ${USER_HOME} /.zshenv"
2536chown " ${USERNAME} :${USERNAME} " " ${USER_HOME} /.bashrc" " ${USER_HOME} /.zshenv"
2637
27- # Run a command as the remote user with a sane PATH so mise writes tools into
28- # the user's own data dir (~/.local/share/mise) rather than root's.
38+ # Feature installers run as root, but the toolchain belongs to the remote user.
2939as_user () {
3040 sudo -u " ${USERNAME} " -H env " PATH=${USER_HOME} /.local/bin:/usr/local/bin:/usr/bin:/bin" " $@ "
3141}
3242
33- # ~/.local/bin is on PATH but nothing creates it now that mise is installed
34- # system-wide; ensure it exists for the Chromium symlink below.
35- as_user mkdir -p " ${USER_HOME} /.local/bin"
36-
37- # Java is always installed (required for JRuby) and listed in .mise.toml so it
38- # is available regardless of which Ruby flavour is used.
39- echo " 📦 Pre-installing java@temurin-21..."
40- as_user " $MISE_BIN " install " java@temurin-21"
41- as_user " $MISE_BIN " use --global " java@temurin-21"
42-
43- # Pre-install Ruby (precompiled) so the container starts immediately.
44- echo " 📦 Pre-installing ruby@${RUBY_VERSION} (precompiled)..."
45- as_user env MISE_RUBY_COMPILE=0 " $MISE_BIN " install " ruby@${RUBY_VERSION} "
46- as_user " $MISE_BIN " use --global " ruby@${RUBY_VERSION} "
47-
48- # Node.js is always needed for the svelte-mini e2e app.
49- echo " 📦 Pre-installing node@lts..."
50- as_user " $MISE_BIN " install " node@lts"
51- as_user " $MISE_BIN " use --global " node@lts"
52-
53- # Install headless Chromium via Playwright (includes all system dependencies)
54- # and symlink the binary into ~/.local/bin which is already on PATH.
55- echo " 📦 Installing headless Chromium via Playwright..."
56- as_user " ${USER_HOME} /.local/share/mise/shims/npx" playwright install chromium --with-deps --only-shell
57- # Playwright lays out the binary under chrome-linux/ on arm64 and chrome-linux64/
58- # on x86_64 (since Playwright 1.57), so the glob has to match both.
59- as_user bash -c " ln -sf ${USER_HOME} /.cache/ms-playwright/chromium-*/chrome-linux*/chrome ${USER_HOME} /.local/bin/chromium"
43+ echo " 📦 Pre-installing toolchain..."
44+ as_user env MISE_RUBY_COMPILE=0 " $MISE_BIN " install \
45+ " java@temurin-21" \
46+ " ruby@${RUBY_VERSION} " \
47+ " node@lts"
6048
6149echo " ✅ Toolchain pre-install completed!"
0 commit comments