Skip to content

feat(docker-run): add --rebuild flag for --no-cache image rebuild - #837

Merged
tcsenpai merged 1 commit into
stabilisationfrom
feat/docker-run-rebuild-flag
May 21, 2026
Merged

feat(docker-run): add --rebuild flag for --no-cache image rebuild#837
tcsenpai merged 1 commit into
stabilisationfrom
feat/docker-run-rebuild-flag

Conversation

@tcsenpai

Copy link
Copy Markdown
Contributor

Summary

Adds --rebuild to scripts/docker-run. Forces docker compose build --no-cache node before up. Operators pulling new commits had to remember the rebuild step separately; the flag folds it into the launcher.

Usage

./run --docker --rebuild --clean -d   # full reset + rebuild + up
./run --docker --rebuild -d           # rebuild image only, keep volumes

Order: --rebuild runs after --clean (volumes wiped first) so the freshly built image is paired with empty data. Only fires when the compose subcommand resolves to up; explicit down / logs / ps skip the rebuild.

Why

PR #836 (Dockerfile prune fix) ships with a layer-cache trap: existing images may still carry the broken node_modules from before the fix. Operators need a --no-cache rebuild to pick up the new pruning rules. The --rebuild flag makes that a one-flag launcher invocation instead of a two-step sequence.

Test plan

  • ./scripts/docker-run --help shows the new flag in the list and the examples.
  • ./scripts/docker-run --rebuild -d runs docker compose build --no-cache node and brings the stack up.
  • ./scripts/docker-run --rebuild --clean -d wipes volumes, rebuilds image, brings up fresh.
  • ./scripts/docker-run --rebuild down does NOT rebuild (subcommand mismatch).

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-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@tcsenpai has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 3 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ad20df5d-9ae5-4f14-8adf-6a9381585d8a

📥 Commits

Reviewing files that changed from the base of the PR and between 08af65d and 012278c.

📒 Files selected for processing (1)
  • scripts/docker-run
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/docker-run-rebuild-flag

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tcsenpai
tcsenpai merged commit b500c08 into stabilisation May 21, 2026
1 of 2 checks passed
@tcsenpai
tcsenpai deleted the feat/docker-run-rebuild-flag branch May 21, 2026 13:51
@greptile-apps

greptile-apps Bot commented May 21, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a --rebuild flag to scripts/docker-run that runs docker compose build --no-cache node before up, making it easy for operators to force a fresh image after pulling new commits (particularly after the Dockerfile prune fix in PR #836).

  • The help sed range is updated from '2,36p' to '2,42p', but the comment block ends at line 40 — lines 41–42 are a blank line and set -euo pipefail, so every --help invocation will print set -euo pipefail at the bottom.
  • The rebuild docker compose build call omits ${PROFILES[@]} and ${EXTRA_PROFILES[@]} that every other compose invocation in the script carries, making the build step inconsistent with the surrounding teardown and startup commands.

Confidence Score: 3/5

The --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

Filename Overview
scripts/docker-run Adds --rebuild flag that runs docker compose build --no-cache node before up; help sed range overshoots and leaks set -euo pipefail into output, and the build step omits profile flags unlike other compose calls.

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]
Loading

Reviews (1): Last reviewed commit: "feat(docker-run): add --rebuild flag for..." | Re-trigger Greptile

Comment thread scripts/docker-run
;;
--help|-h)
sed -n '2,36p' "$0" | sed 's/^# \{0,1\}//'
sed -n '2,42p' "$0" | sed 's/^# \{0,1\}//'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 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).

Suggested change
sed -n '2,42p' "$0" | sed 's/^# \{0,1\}//'
sed -n '2,40p' "$0" | sed 's/^# \{0,1\}//'

Comment thread scripts/docker-run
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 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.

Suggested change
docker compose "${COMPOSE_ARGS[@]}" build --no-cache node
docker compose "${COMPOSE_ARGS[@]}" ${PROFILES[@]+"${PROFILES[@]}"} ${EXTRA_PROFILES[@]+"${EXTRA_PROFILES[@]}"} build --no-cache node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant