Docker: Move build init scripts

This commit is contained in:
Michael Mayer
2022-02-18 17:40:58 +01:00
parent 94852e3394
commit 88cc1b3a73
29 changed files with 250 additions and 167 deletions

View File

@@ -9,7 +9,7 @@ RUN npm install -g npm
# copy scripts to test changes
COPY --chown=root:root /docker/develop/entrypoint.sh /entrypoint.sh
COPY --chown=root:root /docker/scripts/Makefile /root/Makefile
COPY --chown=root:root /scripts/init/Makefile /root/Makefile
# set up project directory
WORKDIR "/go/src/github.com/photoprism/photoprism"

3
assets/.buildignore Normal file
View File

@@ -0,0 +1,3 @@
examples
README.md
.*

2
build/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

View File

@@ -42,8 +42,8 @@ import (
var version = "development"
var log = event.Log
const appDescription = "The documentation can be found at https://docs.photoprism.app/. This is free software. " +
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
const appDescription = "For installation instructions, visit https://docs.photoprism.app/"
const appCopyright = "(c) 2018-2022 Michael Mayer <hello@photoprism.app>"
func main() {
app := cli.NewApp()
@@ -52,7 +52,7 @@ func main() {
app.Usage = "Browse Your Life in Pictures"
app.Description = appDescription
app.Version = version
app.Copyright = "(c) 2018-2022 Michael Mayer <hello@photoprism.app>"
app.Copyright = appCopyright
app.EnableBashCompletion = true
app.Flags = config.GlobalFlags

View File

@@ -19,15 +19,15 @@ ENV DEBIAN_FRONTEND="noninteractive" \
GO111MODULE="on" \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# update image and install build dependencies
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
@@ -75,7 +75,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
sudo && \
/root/.local/bin/install-nodejs.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh && \
mkdir -p "/go/src" "/go/bin" && \
chmod -R 777 "/go"

View File

@@ -21,15 +21,15 @@ ENV DEBIAN_FRONTEND="noninteractive" \
GO111MODULE="on" \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# copy backport packages source list
COPY --chown=root:root --chmod=644 /docker/develop/bullseye/backports.list /etc/apt/sources.list.d/backports.list
@@ -87,8 +87,8 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
apache2-utils && \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-mariadb-client.sh && \
/root/.local/bin/install-darktable.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \
mkdir -p "/go/src" "/go/bin" && \
chmod -R 777 "/go"

View File

@@ -21,15 +21,15 @@ ENV DEBIAN_FRONTEND="noninteractive" \
GO111MODULE="on" \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# copy backport packages source list
COPY --chown=root:root --chmod=644 /docker/develop/buster/backports.list /etc/apt/sources.list.d/backports.list
@@ -86,8 +86,8 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
lsof \
apache2-utils && \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-darktable.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \
mkdir -p "/go/src" "/go/bin" && \
chmod -R 777 "/go"

View File

@@ -21,15 +21,15 @@ ENV DEBIAN_FRONTEND="noninteractive" \
GO111MODULE="on" \
CGO_CFLAGS="-g -O2 -Wno-return-local-addr"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts to /root/.local/bin
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts to /root/.local/bin
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# update image and install build dependencies
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
@@ -84,10 +84,10 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
fonts-roboto \
sudo && \
/root/.local/bin/install-nodejs.sh && \
/root/.local/bin/install-darktable.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh ${TARGETARCH} && \
/root/.local/bin/install-devtools.sh ${TARGETARCH} && \
/root/.local/bin/install-go.sh ${TARGETARCH} && \
/root/.local/bin/install-tensorflow.sh && \
/root/.local/bin/install-darktable.sh && \
/root/.local/bin/install-devtools.sh && \
/root/.local/bin/install-go.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/* && \
mkdir -p "/go/src" "/go/bin" && \
chmod -R 777 "/go"

View File

@@ -27,15 +27,15 @@ ARG TARGETPLATFORM
ENV DEBIAN_FRONTEND="noninteractive" \
TMPDIR="/tmp"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# install additional distribution packages
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \

View File

@@ -27,15 +27,15 @@ ARG TARGETPLATFORM
ENV DEBIAN_FRONTEND="noninteractive" \
TMPDIR="/tmp"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# copy debian backports source
COPY --chown=root:root --chmod=644 /docker/develop/bullseye/backports.list /etc/apt/sources.list.d/backports.list
@@ -59,7 +59,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
ffmpegthumbnailer \
libavcodec-extra && \
/root/.local/bin/install-mariadb-client.sh && \
/root/.local/bin/install-darktable.sh ${TARGETARCH} && \
/root/.local/bin/install-darktable.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/*
# set environment variables, see https://docs.photoprism.app/getting-started/config-options/

View File

@@ -27,15 +27,15 @@ ARG TARGETPLATFORM
ENV DEBIAN_FRONTEND="noninteractive" \
TMPDIR="/tmp"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# copy backports sources
COPY --chown=root:root --chmod=644 /docker/develop/buster/backports.list /etc/apt/sources.list.d/backports.list
@@ -60,7 +60,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra && \
/root/.local/bin/install-darktable.sh ${TARGETARCH} && \
/root/.local/bin/install-darktable.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/*
# set environment variables, see https://docs.photoprism.app/getting-started/config-options/

View File

@@ -27,15 +27,15 @@ ARG TARGETPLATFORM
ENV DEBIAN_FRONTEND="noninteractive" \
TMPDIR="/tmp"
# configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \
echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/80forceyes && \
echo 'APT::Get::Fix-Missing "true";' > /etc/apt/apt.conf.d/80fixmissing
# copy scripts
COPY --chown=root:root --chmod=755 /docker/scripts/* /root/.local/bin/
# copy init scripts
COPY --chown=root:root --chmod=755 /scripts/init/* /root/.local/bin/
# install additional distribution packages
RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-install-recommends \
@@ -56,7 +56,7 @@ RUN apt-get update && apt-get -qq dist-upgrade && apt-get -qq install --no-insta
ffmpeg \
ffmpegthumbnailer \
libavcodec-extra && \
/root/.local/bin/install-darktable.sh ${TARGETARCH} && \
/root/.local/bin/install-darktable.sh && \
apt-get -y autoremove && apt-get -y autoclean && apt-get -y clean && rm -rf /var/lib/apt/lists/*
# set environment variables, see https://docs.photoprism.app/getting-started/config-options/

View File

@@ -1,48 +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
set -e
if [[ -z $1 ]]; then
echo "Usage: install-devtools.sh [amd64|arm64|arm]" 1>&2
exit 1
else
set -eux;
umask 0000
# Install Chrome or Chromium
if [[ $1 == "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 [[ $1 == "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 [[ $1 == "amd64" ]]; then
npm install --unsafe-perm=true --allow-root -g puppeteer testcafe testcafe-browser-provider-puppeteer chromedriver
elif [[ $1 == "arm64" ]]; then
npm install --unsafe-perm=true --allow-root -g testcafe chromedriver
fi
fi

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-go.sh as root" 1>&2
exit 1
fi
set -e
GOLANG_VERSION=1.17.7
if [[ -z $1 ]]; then
echo "Usage: install-go.sh [amd64|arm64|arm]" 1>&2
exit 1
else
set -eux;
if [[ $1 == "amd64" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"
CHECKSUM="02b111284bedbfa35a7e5b74a06082d18632eff824fd144312f6063943d49259 *go.tgz"
elif [[ $1 == "arm64" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz"
CHECKSUM="a5aa1ed17d45ee1d58b4a4099b12f8942acbd1dd09b2e9a6abb1c4898043c5f5 *go.tgz"
elif [[ $1 == "arm" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz"
CHECKSUM="874774f078b182fa21ffcb3878467eb5cb7e78bbffa6343ea5f0fbe47983433b *go.tgz"
else
echo "install-go: unsupported architecture" 1>&2
exit 1
fi
wget -O go.tgz $URL
echo $CHECKSUM | sha256sum -c -
rm -rf /usr/local/go
tar -C /usr/local -xzf go.tgz
rm go.tgz
/usr/local/go/bin/go version
fi

View File

@@ -1,31 +0,0 @@
#!/usr/bin/env bash
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-tensorflow.sh as root" 1>&2
exit 1
fi
if [[ -z $1 ]] && [[ -z $2 ]]; then
echo "Usage: install-tensorflow.sh [amd64|arm64|arm] [cpu|avx|avx2]" 1>&2
exit 1
else
echo "install-tensorflow: downloading library..."
if [[ $1 == "amd64" ]]; then
TARGETARCH="linux"
TARGETVARIANT="-${2:-"cpu"}"
URL="https://dl.photoprism.app/tensorflow/$TARGETARCH/libtensorflow-${TARGETARCH}${TARGETVARIANT}-1.15.2.tar.gz"
elif [[ $1 == "arm64" ]]; then
URL="https://dl.photoprism.app/tensorflow/$1/libtensorflow-$1-1.15.2.tar.gz"
elif [[ $1 == "arm" ]]; then
URL="https://dl.photoprism.app/tensorflow/$1/libtensorflow-$1-1.15.2.tar.gz"
else
echo "install-tensorflow: unsupported architecture" 1>&2
exit 1
fi
echo "$URL"
curl -fsSL "$URL" | \
tar --overwrite -C "/usr" -xz && \
ldconfig
echo "install-tensorflow: done"
fi

View File

@@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV TMP /tmp
ENV EXTRA_BAZEL_ARGS "--host_javabase=@local_jdk//:jdk"
# Configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \

View File

@@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV TMP /tmp
ENV EXTRA_BAZEL_ARGS "--host_javabase=@local_jdk//:jdk"
# Configure apt
# apt default settings
RUN echo 'Acquire::Retries "10";' > /etc/apt/apt.conf.d/80retry && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/80recommends && \
echo 'APT::Install-Suggests "false";' > /etc/apt/apt.conf.d/80suggests && \

View File

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

42
scripts/init/arch.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# This script returns the normalized machine architecture (amd64, arm64, or arm).
# An error is returned if the architecture is currently not supported by PhotoPrism.
if [[ $TARGETARCH ]]; then
SYSTEM_ARCH=$TARGETARCH
elif [[ $OS == "Windows_NT" ]]; then
if [[ $PROCESSOR_ARCHITEW6432 == "AMD64" || $PROCESSOR_ARCHITECTURE == "AMD64" ]]; then
SYSTEM_ARCH=amd64
else
echo "Unsupported Windows Architecture" 1>&2
exit 1
fi
else
SYSTEM_ARCH=$(arch)
fi
BUILD_ARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
case $BUILD_ARCH in
amd64 | AMD64 | x86_64)
BUILD_ARCH=amd64
;;
arm64 | ARM64 | aarch64)
BUILD_ARCH=arm64
;;
arm | ARM | aarch | armv7l | armhf | arm6l)
BUILD_ARCH=arm
;;
*)
echo "Unsupported Machine Architecture: \"$BUILD_ARCH\"" 1>&2
exit 1
;;
esac
export BUILD_ARCH=$BUILD_ARCH
echo $BUILD_ARCH

View File

@@ -16,3 +16,5 @@ export TMPDIR="/tmp"
apt-get -y update
apt-get -y dist-upgrade
apt-get -y autoremove
echo "Packages updated."

View File

@@ -8,12 +8,14 @@ fi
set -e
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
. /etc/os-release
if [[ -z $1 ]]; then
echo "Usage: install-darktable.sh [amd64|arm64|arm]" 1>&2
exit 1
elif [[ $1 == "amd64" ]]; then
echo "Installing Darktable for ${INSTALL_ARCH^^}..."
if [[ $INSTALL_ARCH == "amd64" ]]; then
if [[ $VERSION_CODENAME == "bullseye" ]]; then
echo 'deb http://download.opensuse.org/repositories/graphics:/darktable/Debian_11/ /' | tee /etc/apt/sources.list.d/graphics:darktable.list
curl -fsSL https://download.opensuse.org/repositories/graphics:darktable/Debian_11/Release.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/graphics_darktable.gpg > /dev/null
@@ -28,8 +30,8 @@ elif [[ $1 == "amd64" ]]; then
echo "install-darktable: installing standard amd64 (Intel 64-bit) package"
apt-get -qq install darktable
fi
echo "install-darktable: done"
elif [[ $1 == "arm64" ]]; then
echo "Installed."
elif [[ $INSTALL_ARCH == "arm64" ]]; then
if [[ $VERSION_CODENAME == "bullseye" ]]; then
apt-get update
apt-get -qq install -t bullseye-backports darktable
@@ -40,7 +42,7 @@ elif [[ $1 == "arm64" ]]; then
echo "install-darktable: installing standard amd64 (ARM 64-bit) package"
apt-get -qq install darktable
fi
echo "install-darktable: done"
echo "Installed."
else
echo "install-darktable: unsupported architecture $1"
echo "Unsupported Machine Architecture: $INSTALL_ARCH"
fi

View File

@@ -0,0 +1,56 @@
#!/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 "Installed."

48
scripts/init/install-go.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
GOLANG_VERSION=1.17.7
DESTDIR=$(realpath "${1:-/usr/local}")
echo "Installing Go in \"$DESTDIR\"..."
# abort if the user is not root
if [[ $(id -u) != "0" ]]; then
echo "Usage: run install-go.sh as root" 1>&2
exit 1
fi
set -e
mkdir -p "$DESTDIR"
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
set -eux;
if [[ $INSTALL_ARCH == "amd64" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"
CHECKSUM="02b111284bedbfa35a7e5b74a06082d18632eff824fd144312f6063943d49259 *go.tgz"
elif [[ $INSTALL_ARCH == "arm64" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz"
CHECKSUM="a5aa1ed17d45ee1d58b4a4099b12f8942acbd1dd09b2e9a6abb1c4898043c5f5 *go.tgz"
elif [[ $INSTALL_ARCH == "arm" ]]; then
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz"
CHECKSUM="874774f078b182fa21ffcb3878467eb5cb7e78bbffa6343ea5f0fbe47983433b *go.tgz"
else
echo "Unsupported Machine Architecture: $INSTALL_ARCH" 1>&2
exit 1
fi
echo "Downloading Go from \"$URL\". Please wait."
wget -O go.tgz $URL
echo $CHECKSUM | sha256sum -c -
rm -rf /usr/local/go
tar -C /usr/local -xzf go.tgz
rm go.tgz
/usr/local/go/bin/go version
echo "Installed."

View File

@@ -8,4 +8,5 @@ fi
curl -Ls https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version="mariadb-10.6"
apt-get update
apt-get -qq install mariadb-client
apt-get -qq install mariadb-client
echo "Installed."

View File

@@ -11,3 +11,4 @@ curl -sL https://deb.nodesource.com/setup_16.x | bash -
apt-get update && apt-get -qq install nodejs
npm install --unsafe-perm=true --allow-root -g npm
npm config set cache ~/.cache/npm
echo "Installed."

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
set -e
TF_VERSION="1.15.2"
DESTDIR=$(realpath "${1:-/usr}")
echo "Installing TensorFlow in \"$DESTDIR\"..."
# abort if the user is not root
if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
echo "Error: Run install-tensorflow.sh as root to install in a system directory!" 1>&2
exit 1
fi
mkdir -p "$DESTDIR"
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
INSTALL_ARCH=${2:-$SYSTEM_ARCH}
if [[ -z $3 ]]; then
URL="https://dl.photoprism.app/tensorflow/${INSTALL_ARCH}/libtensorflow-${INSTALL_ARCH}-${TF_VERSION}.tar.gz"
else
URL="https://dl.photoprism.app/tensorflow/${INSTALL_ARCH}/libtensorflow-${INSTALL_ARCH}-${2}-${TF_VERSION}.tar.gz"
fi
echo "Downloading $INSTALL_ARCH libs from \"$URL\". Please wait."
curl -fsSL "$URL" | tar --overwrite --mode=755 -C "$DESTDIR" -xz
if [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]; then
echo "Running ldconfig..."
ldconfig
else
echo "Running \"ldconfig -n $DESTDIR/lib\"."
ldconfig -n "$DESTDIR/lib"
fi
echo "Installed."