diff --git a/docker/develop/bullseye/Dockerfile b/docker/develop/bullseye/Dockerfile index cfbddc95c..c40dd6c82 100644 --- a/docker/develop/bullseye/Dockerfile +++ b/docker/develop/bullseye/Dockerfile @@ -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 \ diff --git a/docker/develop/buster/Dockerfile b/docker/develop/buster/Dockerfile index c2948e7fa..619b508ca 100644 --- a/docker/develop/buster/Dockerfile +++ b/docker/develop/buster/Dockerfile @@ -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 && \ diff --git a/docker/develop/impish/Dockerfile b/docker/develop/impish/Dockerfile index e440fb3ce..52441eb3e 100644 --- a/docker/develop/impish/Dockerfile +++ b/docker/develop/impish/Dockerfile @@ -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" && \ diff --git a/frontend/karma.conf.js b/frontend/karma.conf.js index 9f9400a5f..04c86df60 100644 --- a/frontend/karma.conf.js +++ b/frontend/karma.conf.js @@ -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, diff --git a/scripts/dist/.buildignore b/scripts/dist/.buildignore index c1925418e..9abb766ce 100644 --- a/scripts/dist/.buildignore +++ b/scripts/dist/.buildignore @@ -1,2 +1 @@ -.* -install-devtools.sh \ No newline at end of file +.* \ No newline at end of file diff --git a/scripts/dist/install-chrome.sh b/scripts/dist/install-chrome.sh new file mode 100755 index 000000000..4b43a92dc --- /dev/null +++ b/scripts/dist/install-chrome.sh @@ -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." \ No newline at end of file diff --git a/scripts/dist/install-devtools.sh b/scripts/dist/install-devtools.sh deleted file mode 100755 index cabb2c03c..000000000 --- a/scripts/dist/install-devtools.sh +++ /dev/null @@ -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 < /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." \ No newline at end of file diff --git a/scripts/dist/install-nodejs.sh b/scripts/dist/install-nodejs.sh index cea6f792c..817695f19 100755 --- a/scripts/dist/install-nodejs.sh +++ b/scripts/dist/install-nodejs.sh @@ -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." \ No newline at end of file