05a116beee
Run Tests / test (pull_request) Successful in 32s
VPS 部署與功能驗證皆已完成(tasks.md 7.7/7.8),change 移入 archive/2026-08-04-bake-image-remove-bind-mount。同步兩份 delta spec: 新建 image-baked-deployment 主規格(multi-stage build、symlink 建立、 nginx 獨立 build target、env_file 注入等 11 條 requirement);更新 scheduler-container 補上「不依賴 bind mount」的敘述與 scenario。 openspec validate --strict --specs 39/39 全過。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0142LC1kQb8EyV59TjHDkhWS
30 lines
1.7 KiB
Markdown
30 lines
1.7 KiB
Markdown
# scheduler-container
|
||
|
||
## Purpose
|
||
|
||
Laravel Scheduler 以獨立 container 執行,取代 app container 內的 cron daemon。
|
||
|
||
## Requirements
|
||
|
||
### Requirement: Scheduler 以獨立 container 執行
|
||
`docker-compose.yml` SHALL 定義 `scheduler` service,使用 `cfdive-platform` image(其中已於 build 階段內嵌完整程式碼,不依賴 `./:/var/www` bind mount),以 `php artisan schedule:work` 前台輪詢方式執行 Laravel Scheduler,取代原本在 app container 內的 cron daemon。
|
||
|
||
#### Scenario: Scheduler container 隨 app 啟動
|
||
- **WHEN** 執行 `docker compose up -d` 且 `app` container 已 healthy
|
||
- **THEN** `scheduler` container 啟動並持續執行 `php artisan schedule:work`
|
||
|
||
#### Scenario: App container 重啟時 scheduler 等待就緒
|
||
- **WHEN** `app` container 重啟中(unhealthy)
|
||
- **THEN** `scheduler` container 依 `depends_on` 等待 `app` healthy 後才啟動,避免 scheduler 在 PHP-FPM 未就緒時執行任務
|
||
|
||
#### Scenario: Scheduler 不依賴主機 bind mount 取得程式碼
|
||
- **WHEN** 執行 `docker compose -f docker-compose.yml up -d`(production,不含 override)
|
||
- **THEN** `scheduler` container 執行的排程任務程式碼完全來自 `cfdive-platform` image build 時內嵌的內容,與主機端程式碼目錄是否存在無關
|
||
|
||
### Requirement: App container 不再包含 cron daemon
|
||
`Dockerfile` SHALL 不安裝 `cron` 套件,`docker-entrypoint.sh` SHALL 不執行 `service cron start`,確保 app container 職責單一(只跑 PHP-FPM)。
|
||
|
||
#### Scenario: App container 啟動不啟動 cron
|
||
- **WHEN** `app` container 啟動並執行 entrypoint
|
||
- **THEN** 不存在 cron daemon 程序,`pgrep cron` 回傳 exit code 1
|