diff options
author | Logan Hunt <logan.hunt@usu.edu> | 2023-01-31 15:59:33 -0700 |
---|---|---|
committer | Logan Hunt <logan.hunt@usu.edu> | 2023-01-31 15:59:33 -0700 |
commit | 387ac72d1bdf44f882f3f1ae23b9415884234cbe (patch) | |
tree | 11d484f5b7fabddc6bae9af67f0174d5f3ff0b01 /buildscripts/build/build_server.sh | |
parent | e3604eaeb8bbabb48418db45fd7611722428ae2e (diff) | |
download | chessh-387ac72d1bdf44f882f3f1ae23b9415884234cbe.tar.gz chessh-387ac72d1bdf44f882f3f1ae23b9415884234cbe.zip |
Distributed build tasks!!
Diffstat (limited to 'buildscripts/build/build_server.sh')
-rwxr-xr-x | buildscripts/build/build_server.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/buildscripts/build/build_server.sh b/buildscripts/build/build_server.sh new file mode 100755 index 0000000..0870c79 --- /dev/null +++ b/buildscripts/build/build_server.sh @@ -0,0 +1,40 @@ +#!/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 +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 +else + cd $chessh_path + git pull origin main +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 +sudo systemctl enable --now chessh +sudo systemctl restart chessh |