Files
haiyushuke-website/scripts/docker/deploy-load-tar.sh
2026-06-16 14:34:09 +08:00

16 lines
603 B
Bash
Raw Permalink 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
# 无法 pull 时:本机 build-push.ps1 -ExportTar拷 tar 到服务器后执行
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TAR_FILE="${1:-${SCRIPT_DIR}/haiyushuke-website-latest.tar}"
ENV_FILE="${ENV_FILE:-${SCRIPT_DIR}/deploy.env}"
COMPOSE_FILE="${SCRIPT_DIR}/docker-compose.yml"
[[ -f "${ENV_FILE}" ]] || { echo "missing ${ENV_FILE}" >&2; exit 1; }
[[ -f "${TAR_FILE}" ]] || { echo "missing tar: ${TAR_FILE}" >&2; exit 1; }
cd "${SCRIPT_DIR}"
docker load -i "${TAR_FILE}"
docker compose --env-file "${ENV_FILE}" -f "${COMPOSE_FILE}" up -d