Tests: Pre-install testcafe in develop base images

This commit is contained in:
Michael Mayer 2022-02-23 12:10:34 +01:00
parent 11cbb544fa
commit c16ae62d3e
8 changed files with 89 additions and 110 deletions

View file

@ -56,6 +56,7 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
gettext \
chromium \
chromium-driver \
chromium-sandbox \
firefox-esr \
sqlite3 \
libc6-dev \

View file

@ -35,55 +35,56 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing && \
useradd -m -U -u 1000 -d /photoprism photoprism && \
apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
apt-utils \
gpg \
pkg-config \
software-properties-common \
ca-certificates \
build-essential \
gcc \
g++ \
sudo \
bash \
make \
nano \
wget \
curl \
rsync \
unzip \
zip \
git \
gettext \
chromium \
chromium-driver \
mariadb-client \
sqlite3 \
libc6-dev \
libssl-dev \
libxft-dev \
libhdf5-serial-dev \
libpng-dev \
libheif-examples \
librsvg2-bin \
libzmq3-dev \
libx264-dev \
libx265-dev \
libnss3 \
libfreetype6 \
libfreetype6-dev \
libfontconfig1 \
libfontconfig1-dev \
fonts-roboto \
tzdata \
exiftool \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra \
davfs2 \
chrpath \
lsof \
apache2-utils && \
apt-utils \
gpg \
pkg-config \
software-properties-common \
ca-certificates \
build-essential \
gcc \
g++ \
sudo \
bash \
make \
nano \
wget \
curl \
rsync \
unzip \
zip \
git \
gettext \
chromium \
chromium-driver \
chromium-sandbox \
mariadb-client \
sqlite3 \
libc6-dev \
libssl-dev \
libxft-dev \
libhdf5-serial-dev \
libpng-dev \
libheif-examples \
librsvg2-bin \
libzmq3-dev \
libx264-dev \
libx265-dev \
libnss3 \
libfreetype6 \
libfreetype6-dev \
libfontconfig1 \
libfontconfig1-dev \
fonts-roboto \
tzdata \
exiftool \
rawtherapee \
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra \
davfs2 \
chrpath \
lsof \
apache2-utils && \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \

View file

@ -87,7 +87,7 @@ RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \
/root/.local/bin/install-devtools.sh && \
/root/.local/bin/install-chrome.sh && \
/root/.local/bin/install-go.sh && \
/root/.local/bin/cleanup.sh && \
mkdir -p "/go/src" "/go/bin" && \

View file

@ -26,12 +26,18 @@ https://docs.photoprism.app/developer-guide/
const path = require("path");
const findChrome = require("chrome-finder");
const chromeBin = findChrome();
if (chromeBin) {
// proceed, chrome/chromium was found
process.env.CHROME_BIN = chromeBin;
console.log(`chrome-bin: ${chromeBin}`);
} else {
process.env.CHROME_BIN = require("puppeteer").executablePath();
// abort, no chrome binary was found
console.error("Chrome/Chromium not found.");
process.exit(1);
}
// test setup
module.exports = (config) => {
config.set({
logLevel: config.LOG_ERROR,

View file

@ -1,2 +1 @@
.*
install-devtools.sh
.*

28
scripts/dist/install-chrome.sh vendored Executable file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-chrome.sh as root" 1>&2
exit 1
fi
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
if [[ $INSTALL_ARCH != "amd64" ]]; then
echo "Google Chrome (stable) is only available for AMD64."
exit
fi
. /etc/os-release
echo "Installing Google Chrome (stable) on ${ID} for ${INSTALL_ARCH^^}..."
set -e
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update
apt-get -qq install google-chrome-stable
echo "Done."

View file

@ -1,56 +0,0 @@
#!/usr/bin/env bash
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-devtools.sh as root" 1>&2
exit 1
fi
. /etc/os-release
if [[ $ID != "ubuntu" ]]; then
echo "Dev-Tools only need to be installed on Ubuntu Linux."
exit
fi
set -e
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
echo "Installing Dev-Tools for ${INSTALL_ARCH^^}..."
set -eux;
umask 0000
# Install Chrome or Chromium
if [[ $INSTALL_ARCH == "amd64" ]]; then
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
apt-get update
apt-get -qq install google-chrome-stable
elif [[ $INSTALL_ARCH == "arm64" ]]; then
cat <<EOF > /etc/apt/preferences.d/chromium
Package: *
Pin: release o=LP-PPA-saiarcot895-chromium-dev
Pin-Priority: 1002
EOF
add-apt-repository -y ppa:saiarcot895/chromium-dev
apt-get update
apt-get -qq install chromium-browser chromium-codecs-ffmpeg-extra
fi
# Remove package files
apt-get -y autoremove
apt-get -y autoclean
apt-get -y clean
rm -rf /var/lib/apt/lists/*
# Install Puppeteer, TestCafe & ChromeDriver
if [[ $INSTALL_ARCH == "amd64" ]]; then
npm install --unsafe-perm=true --allow-root -g puppeteer testcafe testcafe-browser-provider-puppeteer chromedriver
elif [[ $INSTALL_ARCH == "arm64" ]]; then
npm install --unsafe-perm=true --allow-root -g testcafe chromedriver
fi
echo "Done."

View file

@ -14,7 +14,7 @@ echo "Installing NodeJS and NPM from \"$SETUP_URL\"..."
curl -sL $SETUP_URL | bash -
apt-get update && apt-get -qq install nodejs
npm install --unsafe-perm=true --allow-root -g npm
npm install --unsafe-perm=true --allow-root -g npm testcafe
npm config set cache ~/.cache/npm
echo "Done."