Docker: Create default users and groups #2262 #2228

Creates accounts to run PhotoPrism under a custom user ID. Also adds
them to the video and render groups, which might help to access hardware
transcoding devices.
This commit is contained in:
Michael Mayer
2022-04-18 14:14:32 +02:00
parent 27b84365da
commit c2baf2ae5a
27 changed files with 210 additions and 213 deletions

View File

@@ -8,13 +8,38 @@ if [[ $(id -u) != "0" ]]; then
exit 1
fi
echo "Installing Go Tools..."
if [[ -z "$GOPATH" ]] || [[ -z "$GOBIN" ]]; then
echo "\$GOPATH and \$GOBIN must be set" 1>&2
exit 1
fi
SYSTEM_ARCH=$("$(dirname "$0")/arch.sh")
DESTARCH=${2:-$SYSTEM_ARCH}
echo "Installing Go Tools for ${DESTARCH^^}..."
set -e
mkdir -p "$GOPATH/src" "$GOBIN"
go install github.com/tianon/gosu@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/kyoh86/richgo@latest
go install github.com/psampaz/go-mod-outdated@latest
go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest
go install github.com/mikefarah/yq/v4@latest
# no additional tools on ARMv7 to reduce build time
if [[ $DESTARCH != "arm" ]]; then
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/psampaz/go-mod-outdated@latest
go install github.com/dsoprea/go-exif/v3/command/exif-read-tool@latest
go install github.com/mikefarah/yq/v4@latest
go install github.com/kyoh86/richgo@latest
cp "$GOBIN/richgo" /usr/local/bin/richgo
fi
chmod -R a+rwX "$GOPATH"
# install gosu in /usr/local/sbin
cp "$GOBIN/gosu" /usr/local/sbin/gosu
chown root:root /usr/local/sbin/gosu
chmod 755 /usr/local/sbin/gosu
echo "Done."