mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Develop: Update Go install script and related Dockerfiles
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
2
Makefile
2
Makefile
@@ -172,7 +172,7 @@ install:
|
||||
chmod -R $(INSTALL_MODE_BIN) $(DESTDIR)/bin $(DESTDIR)/lib
|
||||
@echo "PhotoPrism $(BUILD_TAG) has been successfully installed in \"$(DESTDIR)\".\nEnjoy!"
|
||||
install-go:
|
||||
sudo scripts/dist/install-go.sh
|
||||
sudo scripts/dist/install-go.sh latest
|
||||
go build -v ./...
|
||||
install-tensorflow:
|
||||
sudo scripts/dist/install-tensorflow.sh
|
||||
|
||||
@@ -63,8 +63,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
||||
/scripts/install-libheif.sh && \
|
||||
/scripts/install-tensorflow.sh && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
mkdir -p /etc/skel/.config/go && \
|
||||
echo 'off 2024-08-27' > '/etc/skel/.config/go/telemetry' && \
|
||||
mkdir -p /etc/skel/.config/go/telemetry && \
|
||||
echo 'off 2025-01-03' > '/etc/skel/.config/go/telemetry/mode' && \
|
||||
cp -r /etc/skel/.config /root/.config && \
|
||||
GOLANG_VERSION=go1.22.10 /scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
|
||||
@@ -72,8 +72,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
||||
/scripts/install-tensorflow.sh && \
|
||||
/scripts/install-darktable.sh && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
mkdir -p /etc/skel/.config/go && \
|
||||
echo 'off 2024-08-27' > '/etc/skel/.config/go/telemetry' && \
|
||||
mkdir -p /etc/skel/.config/go/telemetry && \
|
||||
echo 'off 2025-01-03' > '/etc/skel/.config/go/telemetry/mode' && \
|
||||
cp -r /etc/skel/.config /root/.config && \
|
||||
GOLANG_VERSION=go1.22.10 /scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
|
||||
@@ -73,8 +73,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
||||
/scripts/install-libheif.sh && \
|
||||
/scripts/install-chrome.sh && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
mkdir -p /etc/skel/.config/go && \
|
||||
echo 'off 2024-08-27' > '/etc/skel/.config/go/telemetry' && \
|
||||
mkdir -p /etc/skel/.config/go/telemetry && \
|
||||
echo 'off 2025-01-03' > '/etc/skel/.config/go/telemetry/mode' && \
|
||||
cp -r /etc/skel/.config /root/.config && \
|
||||
GOLANG_VERSION=go1.22.10 /scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
|
||||
@@ -74,10 +74,10 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
||||
/scripts/install-libheif.sh && \
|
||||
/scripts/install-chrome.sh && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
mkdir -p /etc/skel/.config/go && \
|
||||
echo 'off 2024-08-27' > '/etc/skel/.config/go/telemetry' && \
|
||||
mkdir -p /etc/skel/.config/go/telemetry && \
|
||||
echo 'off 2025-01-03' > '/etc/skel/.config/go/telemetry/mode' && \
|
||||
cp -r /etc/skel/.config /root/.config && \
|
||||
GOLANG_VERSION=go1.22.10 /scripts/install-go.sh && \
|
||||
/scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
echo 'alias go=richgo ll="ls -alh"' >> /etc/skel/.bashrc && \
|
||||
echo 'export PS1="\u@$DOCKER_TAG:\w\$ "' >> /etc/skel/.bashrc && \
|
||||
|
||||
@@ -74,8 +74,8 @@ RUN echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80retries && \
|
||||
/scripts/install-libheif.sh && \
|
||||
/scripts/install-chrome.sh && \
|
||||
echo "ALL ALL=(ALL) NOPASSWD:SETENV: ALL" >> /etc/sudoers.d/all && \
|
||||
mkdir -p /etc/skel/.config/go && \
|
||||
echo 'off 2024-08-27' > '/etc/skel/.config/go/telemetry' && \
|
||||
mkdir -p /etc/skel/.config/go/telemetry && \
|
||||
echo 'off 2025-01-03' > '/etc/skel/.config/go/telemetry/mode' && \
|
||||
cp -r /etc/skel/.config /root/.config && \
|
||||
GOLANG_VERSION=go1.22.10 /scripts/install-go.sh && \
|
||||
/scripts/install-go-tools.sh && \
|
||||
|
||||
2
scripts/dist/install-admin-tools.sh
vendored
2
scripts/dist/install-admin-tools.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the "duf" and "muffet" admin tools on Linux.
|
||||
# Installs the "duf" and "muffet" admin tools on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-admin-tools.sh)
|
||||
|
||||
# Abort if not executed as root..
|
||||
|
||||
2
scripts/dist/install-caddy.sh
vendored
2
scripts/dist/install-caddy.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the Caddy web server on Linux.
|
||||
# Installs the Caddy web server on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-caddy.sh)
|
||||
|
||||
set -e
|
||||
|
||||
2
scripts/dist/install-chrome.sh
vendored
2
scripts/dist/install-chrome.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs Google Chrome on Linux.
|
||||
# Installs Google Chrome on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-chrome.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-darktable.sh
vendored
2
scripts/dist/install-darktable.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs Darktable on Linux.
|
||||
# Installs Darktable on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-darktable.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-davfs.sh
vendored
2
scripts/dist/install-davfs.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the DavFS filesystem driver on Linux.
|
||||
# Installs the DavFS filesystem driver on Linux.
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
|
||||
2
scripts/dist/install-docker.sh
vendored
2
scripts/dist/install-docker.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs Docker on Ubuntu Linux
|
||||
# Installs Docker on Ubuntu Linux
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-docker.sh)
|
||||
|
||||
echo "Installing Docker..."
|
||||
|
||||
2
scripts/dist/install-ffmpeg.sh
vendored
2
scripts/dist/install-ffmpeg.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the static FFmpeg build available at https://johnvansickle.com/ffmpeg/.
|
||||
# Installs the static FFmpeg build available at https://johnvansickle.com/ffmpeg/.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-ffmpeg.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-firewall.sh
vendored
2
scripts/dist/install-firewall.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs a simple firewall on Ubuntu Linux that only allows incoming http, https and ssh connections.
|
||||
# Installs a simple firewall on Ubuntu Linux that only allows incoming http, https and ssh connections.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-firewall.sh)
|
||||
|
||||
# Install ufw package if needed:
|
||||
|
||||
2
scripts/dist/install-go-tools.sh
vendored
2
scripts/dist/install-go-tools.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs Go tools on Linux.
|
||||
# Installs development tools for Go on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-go-tools.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:/usr/local/go/bin:/go/bin:$PATH"
|
||||
|
||||
85
scripts/dist/install-go.sh
vendored
85
scripts/dist/install-go.sh
vendored
@@ -1,24 +1,44 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs latest Go on Linux.
|
||||
# Downloads and installs the Go compiler on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-go.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
DESTDIR=$(realpath "${1:-/usr/local}")
|
||||
# Show usage information?
|
||||
if [[ ${1} == "--help" ]]; then
|
||||
echo "${0##*/} [version] [destdir] downloads and installs the Go compiler on Linux, for example:" 1>&2
|
||||
echo "${0##*/}" 1>&2
|
||||
echo "${0##*/} latest" 1>&2
|
||||
echo "${0##*/} 1.23.4 /usr/local" 1>&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Query version.
|
||||
if [[ -z $GOLANG_VERSION ]]; then
|
||||
GOLANG_VERSION="go1.22.10"
|
||||
elif [[ $GOLANG_VERSION == "latest" ]]; then
|
||||
set -e
|
||||
set +x
|
||||
|
||||
# Check version to be installed:
|
||||
GOLANG_VERSION=${1:-$GOLANG_VERSION}
|
||||
|
||||
if [[ -z $GOLANG_VERSION ]] || [[ $GOLANG_VERSION == "latest" ]]; then
|
||||
GOLANG_VERSION=$(curl -fsSL https://go.dev/VERSION?m=text | head -n 1)
|
||||
fi
|
||||
|
||||
echo "Installing ${GOLANG_VERSION} in \"${DESTDIR}\"..."
|
||||
GOLANG_VERSION=${GOLANG_VERSION#"go"}
|
||||
|
||||
set -e
|
||||
if [[ -z $GOLANG_VERSION ]]; then
|
||||
echo "Go compiler version must be passed as first argument, e.g. 1.23.4" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine the system architecture.
|
||||
# Check destination directory:
|
||||
DESTDIR=$(realpath "${2:-/usr/local}")
|
||||
|
||||
if [[ -z $DESTDIR ]] || [[ $DESTDIR == "default" ]]; then
|
||||
DESTDIR="/usr/local"
|
||||
fi
|
||||
|
||||
# Determine the system architecture:
|
||||
if [[ $PHOTOPRISM_ARCH ]]; then
|
||||
SYSTEM_ARCH=$PHOTOPRISM_ARCH
|
||||
else
|
||||
@@ -27,21 +47,22 @@ fi
|
||||
|
||||
DESTARCH=${BUILD_ARCH:-$SYSTEM_ARCH}
|
||||
|
||||
sudo mkdir -p "$DESTDIR"
|
||||
# Start installation:
|
||||
echo "Installing Go ${GOLANG_VERSION} for ${DESTARCH^^} in \"${DESTDIR}\". Please wait."
|
||||
|
||||
set -eux;
|
||||
sudo mkdir -p "$DESTDIR"
|
||||
|
||||
case $DESTARCH in
|
||||
amd64 | AMD64 | x86_64 | x86-64)
|
||||
URL="https://go.dev/dl/${GOLANG_VERSION}.linux-amd64.tar.gz"
|
||||
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz"
|
||||
;;
|
||||
|
||||
arm64 | ARM64 | aarch64)
|
||||
URL="https://go.dev/dl/${GOLANG_VERSION}.linux-arm64.tar.gz"
|
||||
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-arm64.tar.gz"
|
||||
;;
|
||||
|
||||
arm | ARM | aarch | armv7l | armhf)
|
||||
URL="https://go.dev/dl/${GOLANG_VERSION}.linux-armv6l.tar.gz"
|
||||
URL="https://go.dev/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz"
|
||||
;;
|
||||
|
||||
*)
|
||||
@@ -50,18 +71,32 @@ case $DESTARCH in
|
||||
;;
|
||||
esac
|
||||
|
||||
# Replace current installation in "/usr/local/go".
|
||||
echo "Installing Go for ${DESTARCH^^} from \"$URL\". Please wait."
|
||||
sudo rm -rf /usr/local/go
|
||||
wget --inet4-only -c "$URL" -O - | sudo tar -xz -C /usr/local
|
||||
# Replace current installation in "$DESTDIR/go":
|
||||
echo "Extracting \"${URL}\" to \"${DESTDIR}/go\"..."
|
||||
set -eux;
|
||||
sudo rm -rf "${DESTDIR}/go"
|
||||
wget --inet4-only -c "${URL}" -O - | sudo tar -xz -C "${DESTDIR}"
|
||||
set +x
|
||||
echo "Done."
|
||||
|
||||
# Add symlink to go binary.
|
||||
echo "Adding symbolic links for go and gofmt."
|
||||
sudo ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
||||
sudo ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
||||
# Add symlink to go binary:
|
||||
echo "Adding symbolic links for \"${DESTDIR}/go/bin/go\" and \"${DESTDIR}/go/bin/gofmt\"..."
|
||||
set -eux;
|
||||
sudo ln -sf "${DESTDIR}/go/bin/go" /usr/local/bin/go
|
||||
sudo ln -sf "${DESTDIR}/go/bin/gofmt" /usr/local/bin/gofmt
|
||||
set +x
|
||||
echo "Done."
|
||||
|
||||
# Test go command by showing installed Go version. Telemetry in Go >= 1.23 should be set to "off" in
|
||||
# ~/.config/go/telemetry, see https://go.dev/doc/telemetry. You can otherwise run "go telemetry off".
|
||||
# Telemetry in Go >= 1.23 should be set to "off" in ~/.config/go/telemetry, see https://go.dev/doc/telemetry.
|
||||
# You can do this by running "go telemetry off":
|
||||
echo "Disabling Go telemetry..."
|
||||
set +e -x;
|
||||
mkdir -p ~/.config/go
|
||||
go telemetry off
|
||||
set +x
|
||||
|
||||
# Test go command by showing installed Go version:
|
||||
echo "Installed Go version:"
|
||||
go version
|
||||
|
||||
echo "Done."
|
||||
echo "Enjoy!"
|
||||
2
scripts/dist/install-gpu.sh
vendored
2
scripts/dist/install-gpu.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs GPU drivers on Linux.
|
||||
# Installs GPU drivers on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-gpu.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-jxl.sh
vendored
2
scripts/dist/install-jxl.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs JPEG XL on Linux.
|
||||
# Installs JPEG XL on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-jxl.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-libheif.sh
vendored
2
scripts/dist/install-libheif.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the heif-convert, heif-enc, heif-info, and heif-thumbnailer binaries on Linux.
|
||||
# Installs the heif-convert, heif-enc, heif-info, and heif-thumbnailer binaries on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-libheif.sh)
|
||||
|
||||
set -e
|
||||
|
||||
2
scripts/dist/install-mariadb.sh
vendored
2
scripts/dist/install-mariadb.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs MariaDB on Linux.
|
||||
# Installs MariaDB on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-mariadb.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-nodejs.sh
vendored
2
scripts/dist/install-nodejs.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs NodeJS, NPM and TestCafe on Linux.
|
||||
# Installs NodeJS, NPM and TestCafe on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-nodejs.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
2
scripts/dist/install-nuclei.sh
vendored
2
scripts/dist/install-nuclei.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the Nuclei Vulnerability Scanner on Linux.
|
||||
# Installs the Nuclei Vulnerability Scanner on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-nuclei.sh)
|
||||
|
||||
# Abort if not executed as root..
|
||||
|
||||
2
scripts/dist/install-tensorflow.sh
vendored
2
scripts/dist/install-tensorflow.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This installs the TensorFlow libraries on Linux.
|
||||
# Installs the TensorFlow libraries on Linux.
|
||||
# bash <(curl -s https://raw.githubusercontent.com/photoprism/photoprism/develop/scripts/dist/install-tensorflow.sh)
|
||||
|
||||
PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/scripts:$PATH"
|
||||
|
||||
Reference in New Issue
Block a user