#!/usr/bin/env bash # QNAP 에서 등록 서버(teamat-admin)를 띄운다. 컨테이너는 호스트 포트 8089 를 쓰고, # Caddy 가 teamat-admin.lala.dedyn.io -> 100.101.79.24:8089 로 넘긴다. # # bash scripts/run-qnap.sh build # 이미지 빌드 # bash scripts/run-qnap.sh up # (재)시작 # bash scripts/run-qnap.sh down # 중지 # bash scripts/run-qnap.sh logs # 로그 set -euo pipefail DOCKER="${DOCKER:-/share/CACHEDEV7_DATA/.qpkg/container-station/bin/docker}" BASE="${BASE:-/share/CACHEDEV8_DATA/docker/teamat-admin}" WEB_ROOT="${WEB_ROOT:-/share/CACHEDEV8_DATA/web/www/teamat}" NAME="teamat-admin" IMAGE="teamat-admin:1" PORT="${PORT:-8089}" case "${1:-up}" in build) cd "$BASE/repo" "$DOCKER" build -f studio/Dockerfile.qnap -t "$IMAGE" . ;; up) "$DOCKER" rm -f "$NAME" >/dev/null 2>&1 || true "$DOCKER" run -d --name "$NAME" --restart unless-stopped \ -p "127.0.0.1:$PORT:$PORT" \ -v "$BASE/repo":/repo \ -v "$BASE/config":/config \ -v "$BASE/data":/data \ -v "$WEB_ROOT":/web \ -v "$BASE/.gitconfig":/root/.gitconfig:ro \ -v "$BASE/.git-credentials":/root/.git-credentials \ -e TEAMAT_WEB_ROOT=/web \ -e TEAMAT_ARCHIVE=/data/photos \ -e TEAMAT_PUSH=1 \ -e TEAMAT_DEFAULT_PAGE=m \ "$IMAGE" sleep 2 "$DOCKER" logs --tail 5 "$NAME" || true ;; down) "$DOCKER" rm -f "$NAME" ;; logs) "$DOCKER" logs --tail 60 "$NAME" ;; *) echo "사용법: bash scripts/run-qnap.sh [build|up|down|logs]" >&2 exit 1 ;; esac