feat(docker-run): add --rebuild flag for --no-cache image rebuild - #837
Conversation
Operators pulling new commits had to remember `docker compose build --no-cache node` separately before `./run --docker --clean`. The flag folds the rebuild into the launcher. Order: --rebuild runs after --clean (volumes wiped) so the freshly built image is paired with empty data. Only fires when subcommand is `up`; explicit `down`/`logs` skip. Examples: ./run --docker --rebuild --clean -d # full reset + rebuild + up ./run --docker --rebuild -d # rebuild only, keep volumes
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryAdds a
Confidence Score: 3/5The --rebuild logic itself is safe, but the help range off-by-two causes set -euo pipefail to leak into the --help output on every invocation. The off-by-two in the sed range is a concrete, reproducible output corruption in the help command — anyone running --help will see set -euo pipefail appended to the usage text. The build step also silently drops profile flags that every other compose call in the script carries. scripts/docker-run — help range and profile consistency in the build step both need a fix. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[./scripts/docker-run --rebuild ...] --> B{Parse flags}
B --> C[REBUILD_IMAGE=true]
C --> D{SUBCOMMAND == 'up'?}
D -- No --> E[Skip rebuild\ne.g. down / logs / ps]
D -- Yes --> F{WIPE_VOLUMES == 'true'?}
F -- Yes --> G[docker compose down --volumes\n+ docker volume rm pgdata/node_data]
F -- No --> H[Skip clean]
G --> I[docker compose build\n--no-cache node]
H --> I
I --> J[docker compose up ...]
E --> K[docker compose subcommand]
Reviews (1): Last reviewed commit: "feat(docker-run): add --rebuild flag for..." | Re-trigger Greptile |
| ;; | ||
| --help|-h) | ||
| sed -n '2,36p' "$0" | sed 's/^# \{0,1\}//' | ||
| sed -n '2,42p' "$0" | sed 's/^# \{0,1\}//' |
There was a problem hiding this comment.
The help range
'2,42p' overshoots by two lines. Line 41 in the new file is the blank line between the comment block and set -euo pipefail; line 42 is set -euo pipefail. The second sed 's/^# \{0,1\}//' only strips a leading #-space prefix, so set -euo pipefail passes through unmodified and prints at the bottom of every --help invocation. The range should stop at line 40 (the last example line).
| sed -n '2,42p' "$0" | sed 's/^# \{0,1\}//' | |
| sed -n '2,40p' "$0" | sed 's/^# \{0,1\}//' |
| # explicit `down`/`logs`/etc skip the rebuild. | ||
| if [[ "$REBUILD_IMAGE" == "true" && "$SUBCOMMAND" == "up" ]]; then | ||
| echo "+ --rebuild: docker compose build --no-cache node" | ||
| docker compose "${COMPOSE_ARGS[@]}" build --no-cache node |
There was a problem hiding this comment.
The
--rebuild build step omits ${PROFILES[@]} and ${EXTRA_PROFILES[@]} that are threaded through every other compose invocation in this script (the --clean teardown and the final up). While targeting node by name works today because node is not a profiled service, the inconsistency means that if the compose file ever adds a profile guard around node (or an override in a -f file changes the build context under a profile), this step would silently use the wrong compose graph.
| docker compose "${COMPOSE_ARGS[@]}" build --no-cache node | |
| docker compose "${COMPOSE_ARGS[@]}" ${PROFILES[@]+"${PROFILES[@]}"} ${EXTRA_PROFILES[@]+"${EXTRA_PROFILES[@]}"} build --no-cache node |
Summary
Adds
--rebuildtoscripts/docker-run. Forcesdocker compose build --no-cache nodebeforeup. Operators pulling new commits had to remember the rebuild step separately; the flag folds it into the launcher.Usage
Order:
--rebuildruns after--clean(volumes wiped first) so the freshly built image is paired with empty data. Only fires when the compose subcommand resolves toup; explicitdown/logs/psskip the rebuild.Why
PR #836 (Dockerfile prune fix) ships with a layer-cache trap: existing images may still carry the broken
node_modulesfrom before the fix. Operators need a--no-cacherebuild to pick up the new pruning rules. The--rebuildflag makes that a one-flag launcher invocation instead of a two-step sequence.Test plan
./scripts/docker-run --helpshows the new flag in the list and the examples../scripts/docker-run --rebuild -drunsdocker compose build --no-cache nodeand brings the stack up../scripts/docker-run --rebuild --clean -dwipes volumes, rebuilds image, brings up fresh../scripts/docker-run --rebuild downdoes NOT rebuild (subcommand mismatch).