xiaozhi-esp32-server/deploy.sh
2025-02-27 10:41:51 +08:00

21 lines
No EOL
583 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -x
set -e
COMPOSE_DIR='compose-config'
server_no=$(ifconfig eno1 | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | awk -F. '{print $4}')
compose_file="${COMPOSE_DIR}/${APP_ENV}-${server_no}-docker-compose.yml"
#判断compose_file是否存在,如果不存在echo后-退出-说明
if [ ! -f "$compose_file" ]; then
echo "Error: Compose file '$compose_file' not found. Exiting."
exit 1
fi
echo "Exute compose file: '$compose_file'."
echo "git pull"
git pull
docker compose -f ${compose_file} up -d --build
sleep 3
docker logs -f -n 30 esp32-server