Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically determine Chromium arm64 binary links #191

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions Dockerfile.visual-regression
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@ ENV \
RUN apt-get update && \
apt-get install -y git sudo software-properties-common

# Find links to Chromium arm64 binaries here: http://snapshot.debian.org/binary/chromium/
ENV CHROMIUM_ARM_URL http://snapshot.debian.org/archive/debian-security/20220902T180902Z/pool/updates/main/c/chromium/
ENV CHROMIUM_ARM_BINARY chromium_105.0.5195.52-1~deb11u1_arm64.deb
ENV CHROMIUM_ARM_COMMON_BINARY chromium-common_105.0.5195.52-1~deb11u1_arm64.deb

RUN /bin/bash -c 'set -ex && \
RUN set -ex && \
DEBIAN_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '=' -f2 | tr -d '"') && \
export DEBIAN_VERSION=$DEBIAN_VERSION && \
ARCH=`uname -m` && \
if [ "$ARCH" == "x86_64" ]; then \
if [ "$ARCH" = "x86_64" ]; then \
sudo npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION}; \
else \
sudo PUPPETEER_SKIP_DOWNLOAD=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION} && \
wget "${CHROMIUM_ARM_URL}${CHROMIUM_ARM_COMMON_BINARY}" \
"${CHROMIUM_ARM_URL}${CHROMIUM_ARM_BINARY}" && \
apt install -y "./${CHROMIUM_ARM_COMMON_BINARY}" \
"./${CHROMIUM_ARM_BINARY}" && \
sudo PUPPETEER_SKIP_DOWNLOAD=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install -g --unsafe-perm=true --allow-root backstopjs@${BACKSTOPJS_VERSION} puppeteer-chromium-version-finder@^1.0.1 chromium-version-deb-finder@^2.0.1 && \
NODE_PATH="$(npm root -g):$(npm root -g)/backstopjs/node_modules" node -e " \
const versionFinder = require('puppeteer-chromium-version-finder'); \
const debFinder = require('chromium-version-deb-finder'); \
(async () => { \
const version = await versionFinder.getPuppeteerChromiumVersion(); \
const debUrls = await debFinder.getDebUrlsForVersionAndArch(version.MAJOR, version.MINOR, process.env.DEBIAN_VERSION, 'arm64'); \
console.log(debUrls.join('\n')); \
})(); \
" | \
xargs -I % sh -c 'set -x; echo "Downloading: %"; wget -c -t 10 -w 10 -T 120 %; echo "Downloaded: %"' && \
apt install -y ./*.deb && \
rm -f ./*.deb && \
sudo test -f /usr/bin/chromium && sudo ln -s /usr/bin/chromium /usr/bin/chromium-browser && sudo ln -s /usr/bin/chromium /usr/bin/chrome; \
fi'
fi

RUN wget https://dl-ssl.google.com/linux/linux_signing_key.pub && sudo apt-key add linux_signing_key.pub
RUN sudo add-apt-repository "deb http://dl.google.com/linux/chrome/deb/ stable main"
Expand Down