eight-hourr/scripts/docker-start.sh

29 lines
1.1 KiB
Bash
Executable File
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.

#!/usr/bin/env bash
# Start PTS in Docker with zero host data persistence (tmpfs /data only).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
echo "==> 關閉本地 Python 伺服器(避免佔用 8765"
"$ROOT/scripts/server.sh" stop 2>/dev/null || true
pgrep -f "$ROOT/backend.*main.py" 2>/dev/null | xargs kill 2>/dev/null || true
echo "==> 建置並啟動 Docker無 volume、不寫入本機 pts-data.dockerignore 排除 secrets"
cd "$ROOT"
# Full stop: remove container; no host data mount to clean
docker compose down --remove-orphans 2>/dev/null || true
# Rebuild so COPY respects latest .dockerignore
docker compose build --pull
docker compose up -d --force-recreate --remove-orphans
PORT="${BACKEND_PORT:-8765}"
echo ""
echo "吉八小 · 集滿八小時(容器,不留本機資料)已啟動"
echo " Web UI: http://localhost:$PORT"
echo " 資料: 僅容器內 tmpfs /data停止/刪除容器即消失,不寫本機)"
echo " 查看 log: make docker-logs"
echo " 停止: make docker-down"
echo ""
echo "首次請在網頁登入 PTS與選用 Teams帳密只留在容器記憶體不會存到主機。"