30 lines
748 B
Bash
Executable file
30 lines
748 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -e # Exit on error
|
|
|
|
# Set working paths
|
|
BOT_NAME="mineflayer-bot"
|
|
HOST_DB_PATH="$HOME/mineflayer-bot/db"
|
|
CONTAINER_DB_PATH="/app/bot/db"
|
|
CONTAINER_TASKS_PATH="/app/bot/bot-tasks"
|
|
|
|
echo "📦 Building Docker image for $BOT_NAME..."
|
|
docker buildx build --platform linux/amd64 -t $BOT_NAME . --load
|
|
|
|
echo "🧹 Cleaning up old container (if it exists)..."
|
|
docker rm -f $BOT_NAME 2>/dev/null || true
|
|
|
|
echo "📂 Ensuring local DB path exists..."
|
|
mkdir -p "$HOST_DB_PATH"
|
|
|
|
echo "🚀 Running container..."
|
|
docker run -d \
|
|
--name $BOT_NAME \
|
|
--platform linux/amd64 \
|
|
-v "$HOST_DB_PATH":"$CONTAINER_DB_PATH" \
|
|
-v "$(pwd)/bot/bot-tasks":"$CONTAINER_TASKS_PATH" \
|
|
$BOT_NAME
|
|
|
|
echo "📄 Tailing logs..."
|
|
docker logs -f $BOT_NAME
|
|
|