chessh/buildscripts/build/build_server.sh

41 lines
885 B
Bash
Raw Permalink Normal View History

2023-01-31 17:59:33 -05:00
#!/usr/bin/bash
export $(cat ~/.env | xargs)
chessh_source="https://github.com/Simponic/chessh"
chessh_path="$HOME/src/chessh"
# Grab deps
[ "$(which git)" != "" ] || sudo apt install -y git
if [ "$(which docker)" = "" ]
then
curl -sSL https://get.docker.com | sh
2023-01-31 17:59:33 -05:00
fi
# Checkout source
if [ ! -d $chessh_path ]
then
mkdir -p $chessh_path
cd $chessh_path
git init
git remote add origin $chessh_source
git pull origin
git checkout main
git config pull.rebase true
2023-01-31 17:59:33 -05:00
else
cd $chessh_path
git pull origin main
2023-01-31 17:59:33 -05:00
fi
# Build
cd $chessh_path
[ -d "$chessh_path/priv/keys" ] && cp ~/keys/* "$chessh_path/priv/keys/" || cp -r ~/keys "$chessh_path/priv"
sudo docker build . -t chessh/server
# Systemd service
cd $HOME
sudo mv chessh.service /etc/systemd/system/chessh.service
sudo systemctl daemon-reload
2023-01-31 19:40:50 -05:00
sudo systemctl enable chessh
2023-02-25 01:44:34 -05:00
sudo systemctl restart chessh