mirror of
https://github.com/YunoHost-Apps/photoprism_ynh.git
synced 2024-09-03 19:56:41 +02:00
First docker
This commit is contained in:
parent
ebddc0839a
commit
4fd77c449c
4 changed files with 40 additions and 43 deletions
7
conf/docker-image-extract.src
Normal file
7
conf/docker-image-extract.src
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
SOURCE_URL=https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9
|
||||||
|
SOURCE_SUM=9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67
|
||||||
|
SOURCE_SUM_PRG=sha256sum
|
||||||
|
SOURCE_FORMAT=tar.gz
|
||||||
|
SOURCE_IN_SUBDIR=true
|
||||||
|
SOURCE_FILENAME=
|
||||||
|
SOURCE_EXTRACT=true
|
|
@ -7,7 +7,7 @@ Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
WorkingDirectory=__FINALPATH__/
|
WorkingDirectory=__FINALPATH__/
|
||||||
ExecStart=__FINALPATH__/build/bin/photoprism --config-path __FINALPATH__/build/config/ --trace start
|
ExecStart=__FINALPATH__/live/bin/photoprism --config-path __FINALPATH__/live/config/ --trace start
|
||||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,14 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Tag name of the installed version
|
# Tag name of the installed version
|
||||||
PHOTOPRISM_VERSION="220617-0402b8d3"
|
PHOTOPRISM_VERSION="220617-bullseye"
|
||||||
|
|
||||||
MEMORY_NEEDED="3000"
|
MEMORY_NEEDED="3000"
|
||||||
NODEJS_VERSION=14
|
NODEJS_VERSION=14
|
||||||
GO_VERSION="1.18"
|
GO_VERSION="1.18"
|
||||||
|
|
||||||
pkg_dependencies="libc6-dev libssl-dev libxft-dev libhdf5-serial-dev libpng-dev libheif-examples librsvg2-bin libx264-dev libx265-dev libnss3 libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev libzmq3-dev"
|
#pkg_dependencies="libc6-dev libssl-dev libxft-dev libhdf5-serial-dev libpng-dev libheif-examples librsvg2-bin libx264-dev libx265-dev libnss3 libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev libzmq3-dev"
|
||||||
|
pkg_dependencies=""
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
|
|
|
@ -79,10 +79,10 @@ ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
# Install nodejs
|
# Install nodejs
|
||||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
|
#ynh_install_nodejs --nodejs_version=$NODEJS_VERSION 2>&1
|
||||||
|
|
||||||
# Install go
|
# Install go
|
||||||
ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
|
#ynh_exec_warn_less ynh_install_go --go_version=$GO_VERSION
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD SWAP IF NEEDED
|
# ADD SWAP IF NEEDED
|
||||||
|
@ -125,17 +125,7 @@ ynh_script_progression --message="Setting up source files..." --time --weight=1
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
#ynh_setup_source --dest_dir="$final_path"
|
ynh_setup_source --dest_dir="$final_path/build/" --source_id="docker-image-extract"
|
||||||
|
|
||||||
# I need to use git clone instead of ynh_setup_source
|
|
||||||
|
|
||||||
pushd "/var/www/"
|
|
||||||
git clone https://github.com/photoprism/photoprism
|
|
||||||
popd
|
|
||||||
|
|
||||||
pushd "$final_path"
|
|
||||||
git checkout "$PHOTOPRISM_VERSION" 2>&1
|
|
||||||
popd
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
|
@ -149,28 +139,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --time --weig
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BUILD PHOTOPRISM
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Building Photoprism..." --time --weight=1
|
|
||||||
|
|
||||||
pushd "$final_path"
|
|
||||||
# Setup go exe and environnement
|
|
||||||
ynh_use_go
|
|
||||||
export GOPATH="$final_path/go"
|
|
||||||
export GOCACHE="$final_path/go/.cache"
|
|
||||||
export GOBIN=$GOPATH/bin
|
|
||||||
# Setup tensorflow library
|
|
||||||
./scripts/dist/install-tensorflow.sh
|
|
||||||
# Setup node environment
|
|
||||||
export NODE_OPTIONS=--max_old_space_size=1024
|
|
||||||
# Build server from source
|
|
||||||
ynh_use_nodejs
|
|
||||||
env "$ynh_node_load_PATH" npm install -g npm
|
|
||||||
env "$ynh_node_load_PATH" make dep-tensorflow dep-js dep-go build-js install DESTDIR=$final_path/build 2>&1
|
|
||||||
ynh_secure_remove --file="$final_path/go"
|
|
||||||
popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -179,8 +147,29 @@ ynh_script_progression --message="Creating a data directory..." --time --weight=
|
||||||
datadir=/home/yunohost.app/$app
|
datadir=/home/yunohost.app/$app
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||||
|
|
||||||
mkdir -p "$datadir/assets/"
|
mkdir -p "$datadir"
|
||||||
rsync -a "$final_path/build/assets/" "$datadir/assets/"
|
#rsync -a "$final_path/build/assets/" "$datadir/assets/"
|
||||||
|
|
||||||
|
chmod 750 "$datadir"
|
||||||
|
chmod -R o-rwx "$datadir"
|
||||||
|
chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MAKE INSTALL
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Making install..."
|
||||||
|
|
||||||
|
# Install photoprism
|
||||||
|
pushd $final_path/build
|
||||||
|
./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION
|
||||||
|
popd
|
||||||
|
mv -f "$final_path/build/output/opt/photoprism/" "$final_path/live/"
|
||||||
|
mv -f "$final_path/live/assets/" "$datadir/assets/"
|
||||||
|
ynh_secure_remove --file="$final_path/build"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:$app "$final_path"
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
chmod 750 "$datadir"
|
||||||
chmod -R o-rwx "$datadir"
|
chmod -R o-rwx "$datadir"
|
||||||
|
@ -191,10 +180,10 @@ chown -R $app:www-data "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="options.yml" --destination="$final_path/build/config/options.yml"
|
ynh_add_config --template="../conf/options.yml" --destination="$final_path/live/config/options.yml"
|
||||||
|
|
||||||
chmod 400 "$final_path/build/config/options.yml"
|
chmod 400 "$final_path/live/config/options.yml"
|
||||||
chown $app:$app "$final_path/build/config/options.yml"
|
chown $app:$app "$final_path/live/config/options.yml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
Loading…
Add table
Reference in a new issue