You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add docker_test_before_push config — local test gate before push
- New setting in claude-mastery-project.conf: docker_test_before_push
(disabled by default, enable for production projects)
- When enabled: blocks docker push until image is built, run locally,
verified not to crash, health check passes, no fatal errors in logs
- Updated /optimize-docker command with Step 5 local test gate
- Added Rule 10 to CLAUDE.md and GitHub Pages
- Updated /optimize-docker command card on GitHub Pages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Container is still running after 5 seconds (didn't exit with error)
328
+
- Health endpoint returns HTTP 200
329
+
- No fatal errors in container logs
330
+
331
+
**If any check fails:** Report exactly what failed, show the logs, and do NOT push. Fix the issue first.
332
+
333
+
**When `docker_test_before_push = false` (default):** Skip this step. The user manages their own testing.
334
+
335
+
This gate applies to ALL docker push operations, not just `/optimize-docker`. Any command or workflow that pushes to Docker Hub must check this setting first.
336
+
337
+
## Step 6 — RuleCatch Report
296
338
297
339
After all changes are complete, check RuleCatch:
298
340
299
341
- If the RuleCatch MCP server is available: query for violations in the modified Docker files
300
342
- Report any violations found
301
343
- If no MCP: suggest checking the RuleCatch dashboard
- Worktrees let you run multiple Claude sessions in parallel without conflicts
392
392
- RuleCatch catches violations Claude missed — last line of defense before merge
393
393
394
+
### 10. Docker Push Gate — Local Test Before Push
395
+
396
+
**Disabled by default.** When enabled (`docker_test_before_push = true` in `claude-mastery-project.conf`), ANY `docker push` is BLOCKED until the image passes local verification:
397
+
398
+
1. Build the image
399
+
2. Run the container locally
400
+
3. Wait 5 seconds for startup
401
+
4. Verify container is still running (didn't crash/exit)
402
+
5. Hit the health endpoint (must return 200)
403
+
6. Check logs for fatal errors
404
+
7. Clean up test container
405
+
8.**Only then** allow `docker push`
406
+
407
+
If any step fails: STOP, show what failed, and do NOT push.
408
+
409
+
```bash
410
+
# Enable in claude-mastery-project.conf:
411
+
docker_test_before_push = true
412
+
413
+
# Disable (default):
414
+
docker_test_before_push = false
415
+
```
416
+
417
+
This gate applies globally — every command or workflow that pushes to Docker Hub must respect it.
<h3>Docker Push Gate — Local Test First</h3>
585
+
</div>
586
+
<p><strong>Disabled by default.</strong> When enabled, NO <code>docker push</code> is allowed until the image passes local verification:</p>
587
+
<ol>
588
+
<li>Build the image</li>
589
+
<li>Run the container locally</li>
590
+
<li>Verify it doesn't crash (still running after 5s)</li>
591
+
<li>Health endpoint returns 200</li>
592
+
<li>No fatal errors in logs</li>
593
+
<li>Clean up, <strong>then</strong> push</li>
594
+
</ol>
595
+
<p>Enable with <code>docker_test_before_push = true</code> in <code>claude-mastery-project.conf</code>. Applies to all commands that push Docker images.</p>
<li><strong>No secrets in build args</strong> — runtime env only</li>
846
863
<li><strong>Pin versions</strong> — no <code>:latest</code> tags</li>
847
864
</ol>
848
-
<p>Generates an optimized Dockerfile, verifies <code>.dockerignore</code>, and reports image size estimate with before/after comparison.</p>
865
+
<p>Generates an optimized Dockerfile, verifies <code>.dockerignore</code>, and reports image size estimate with before/after comparison. When <code>docker_test_before_push = true</code> in conf, blocks <code>docker push</code> until the image passes local verification (build, run, health check, no crash).</p>
0 commit comments