add sync_test to build for testing environment

This commit is contained in:
simon 2022-05-07 20:22:51 +07:00
parent 6f9ca5391b
commit f615aeacd5
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 25 additions and 3 deletions

View File

@ -23,10 +23,32 @@ function validate {
}
function sync_test {
host="tubearchivist.local"
# make base folder
ssh "$host" "mkdir -p docker"
# copy project files to build image
rsync -a --progress --delete-after \
--exclude ".git" \
--exclude ".gitignore" \
--exclude "**/cache" \
--exclude "**/__pycache__/" \
. -e ssh "$host":tubearchivist-metrics
ssh "$host" "docker buildx build -t bbilly1/tubearchivist-metrics:latest tubearchivist-metrics --load"
ssh "$host" 'docker compose -f docker/docker-compose.yml up -d'
}
if [[ $1 == "validate" ]]; then
validate
validate "$2"
elif [[ $1 == "test" ]]; then
sync_test
else
echo "valid options are: validate"
echo "valid options are: validate | test"
fi
exit 0
exit 0