Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ docker-compose up -d

应用默认运行在 `http://localhost:3000`(监听 `0.0.0.0`,局域网可访问)。

##Docker更新
## Docker 更新

```bash
./scripts/update-docker.sh
```
# 拉取最新镜像
docker pull ghcr.io/forumlify/public:next
# 重启
docker compose down && docker compose up -d
```

更新脚本兼容 Docker Compose v2(`docker compose`)和 v1(`docker-compose`)。它会先拉取最新的 `app` 镜像,再让 Compose 在镜像发生变化时重新创建应用容器;数据库容器和数据卷不会重建。

---

Expand Down
25 changes: 25 additions & 0 deletions scripts/update-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
Comment thread
lezi-fun marked this conversation as resolved.

set -Eeuo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"

if docker compose version >/dev/null 2>&1; then
compose=(docker compose)
elif command -v docker-compose >/dev/null 2>&1; then
compose=(docker-compose)
else
echo "Docker Compose is required (docker compose or docker-compose)." >&2
exit 1
fi

echo "Pulling the latest Forumlify image..."
"${compose[@]}" pull app

echo "Applying the latest image to the Forumlify app container..."
"${compose[@]}" up -d --no-deps app

echo "Forumlify is now running with the latest image."
"${compose[@]}" ps app
Loading