Skip to content

feat: update app container after image pull - #33

Merged
lezi-fun merged 1 commit into
nextfrom
feat/docker-image-update
Aug 14, 2026
Merged

lezi-fun merged 1 commit into
nextfrom
feat/docker-image-update

Conversation

@lezi-fun

Copy link
Copy Markdown
Collaborator

感谢你为 Forumlify 提交贡献!/ Thank you for contributing to Forumlify!

目标分支 / Target branch

  • Lite(原生单文件版 / Original single-file version)
  • next(Next.js 16 版 / Next.js 16 version)

版本信息 / Version info

不适用 / Not applicable

变更内容 / What does this PR do?

  • 新增 scripts/update-docker.sh,兼容 Docker Compose v2(docker compose)和 v1(docker-compose)。
  • 更新时先拉取最新 app 镜像,再执行 up -d --no-deps app,由 Compose 在镜像变化时自动重新创建应用容器。
  • 更新 README 的 Docker 更新说明。
  • 不包含 download/install.sh。

/ Add a Docker update helper compatible with Compose v1 and v2. It pulls the latest app image and then runs up -d --no-deps app, allowing Compose to recreate the app when the image changes. The database container and volume are left untouched.

动机 / Motivation

当前只拉取镜像或重新启动的操作不够明确,容易继续使用旧容器。统一更新命令后,应用容器会根据镜像变化自动刷新,同时不重建数据库。

/ Make image updates deterministic while keeping the PostgreSQL container and volume intact.

测试 / Testing

  • 本地构建通过 / Local build passes (npm run build,仅 next 分支 / next branch only)
  • 相关功能已手动测试 / Related features manually tested(使用模拟 Docker v1/v2 命令验证调用顺序 / mocked Docker v1/v2 command paths)
  • 测试用例已更新 / Tests updated

截图 / Screenshots

不适用 / Not applicable(无 UI 改动 / no UI changes)

检查清单 / Checklist

  • 我已阅读并遵循了贡献指南 / I have read and followed the contributing guidelines
  • 我的代码遵循现有代码风格 / My code follows the existing code style
  • 我已同步最新的上游分支 / I have synced with the latest upstream branch
  • 本 PR 只包含必要的改动 / This PR contains only the necessary changes

@forumlify forumlify Bot added duplicate This issue or pull request already exists enhancement New feature or request labels Aug 14, 2026
@forumlify

forumlify Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Possible duplicate (likely confidence): #32

PR #32 and PR #33 implement substantially the same intended change: both add scripts/update-docker.sh with Docker Compose v2/v1 detection, pull the latest app image, then run up -d --no-deps app so the app container is recreated only when the image changes, while keeping the PostgreSQL container and db volume untouched. Both also update the README Docker-update instructions, explicitly scope out download/install.sh, and use identical validation approaches (mocked Compose v1/v2 command paths). The commit history of #32 even contains the equivalent feature commit ('feat: recreate app after Docker image updates'), and its review confirms the same behavior is the PR's core. The only extra in #32 is unrelated repository-migration edits (registry/clone URL re-points), which do not change the duplicated core feature.

Related item: #32

This is an automated similarity suggestion. The item has not been closed automatically.

@forumlify

forumlify Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Automated review has started. I am checking this pull request now.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

Affected Assets, Files, and Routes:

view changes for bundle: forumlify-next-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/JZ2hIDhvkhGr2dj2SAplj/_buildManifest.js (New) 1.97kB 1.97kB 100.0% 🚀
server/middleware-*.js -414 bytes 36 bytes -92.0%
server/middleware-*.js 414 bytes 450 bytes 1150.0% ⚠️
server/app/api/auth/recovery-*.js 6 bytes 379 bytes 1.61%
server/app/api/auth/recovery-*.js -6 bytes 373 bytes -1.58%
server/app/api/admin/custom-*.js -4 bytes 355 bytes -1.11%
server/app/api/admin/custom-*.js 4 bytes 359 bytes 1.13%
server/app/api/custom-*.js 4 bytes 347 bytes 1.17%
server/app/api/custom-*.js -4 bytes 343 bytes -1.15%
static/JZ2hIDhvkhGr2dj2SAplj/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/-*.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
static/-*.js (Deleted) -1.97kB 0 bytes -100.0% 🗑️

@codecov

codecov Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@forumlify forumlify Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review

Mode: normal

Comment

Small, sensible change: the helper pulls the app image and recreates only the app container via up -d --no-deps app, leaving PostgreSQL and its volume intact, with proper set -Eeuo pipefail and Docker Compose v1/v2 detection. Before merge, confirm the script has the executable bit (see inline note) and that the compose service is actually named app, since pull app/up -d --no-deps app will fail otherwise. No application code, schema, build, or test behavior is affected.

Result for maintainers

No blocking issues found. The Docker update helper and README changes align with the project's Compose-based deployment and do not touch application code, schema, or tests.

Model decision: safe to merge
Applied review policy: allow
Final status: safe to merge

Required changes: 0
Review notes: 1

Comment thread scripts/update-docker.sh
@lezi-fun

Copy link
Copy Markdown
Collaborator Author

@bot what does this pr change

@forumlify

forumlify Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

This PR makes Docker image updates deterministic. In short:

New script: scripts/update-docker.sh

  • Auto-detects Docker Compose v2 (docker compose) or v1 (docker-compose) and errors out clearly if neither is available.
  • Runs docker compose pull app to fetch the latest app image.
  • Then runs docker compose up -d --no-deps app, so Compose recreates the app container only when the image changed — the PostgreSQL container and its volume are left untouched.
  • Ends by printing docker compose ps app to confirm the new state.

README update

  • The old "Docker 更新" section (manual docker pull + down/up) is replaced with a one-liner pointing to the script, plus a note about the v1/v2 compatibility and that the database isn't rebuilt.

The key behavior change: previously the docs told users to pull and then do down && up -d, which could be disruptive or leave things ambiguous; now the app container is refreshed in place only when the image actually changes.

@lezi-fun
lezi-fun merged commit 5635216 into next Aug 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant