Skip to content

Fix: merge consecutive RUN instructions in frontend Dockerfile#3644

Merged
arkid15r merged 6 commits intoOWASP:mainfrom
Shubb07:fix/dockerfile-consecutive-run
Feb 8, 2026
Merged

Fix: merge consecutive RUN instructions in frontend Dockerfile#3644
arkid15r merged 6 commits intoOWASP:mainfrom
Shubb07:fix/dockerfile-consecutive-run

Conversation

@Shubb07
Copy link
Contributor

@Shubb07 Shubb07 commented Jan 29, 2026

Proposed change

Resolves #3427

This PR fixes a SonarCloud maintainability issue (docker:S7031) in
docker/frontend/Dockerfile, where consecutive RUN instructions were
used.

The instructions were merged into a single RUN layer to reduce the
number of Docker image layers and improve maintainability, following
Docker best practices. This change does not alter any functional
behavior.

Checklist

  • I followed the contributing workflow
  • I verified that my code works as intended and resolves the issue as described
  • The change is limited in scope and does not introduce functional behavior changes
  • I ran make check-test locally: all warnings addressed, tests passed
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

Summary by CodeRabbit

  • Chores
    • Optimized Docker build process and configuration for improved build efficiency and artifact management.

Note: This release contains only internal infrastructure improvements with no user-facing changes.

Walkthrough

Reworked docker/frontend/Dockerfile runner stage to merge consecutive RUNs into a single chain for packaging and patching tar (7.5.7) and @isaacs/brace-expansion (5.0.1), moved WORKDIR usage for packaging, reordered user/group creation after version checks, and expanded final image COPY/ownership and cleanup steps.

Changes

Cohort / File(s) Summary
Docker frontend Dockerfile — runner & packaging
docker/frontend/Dockerfile
Merged consecutive RUNs into one chain; perform tar and @isaacs/brace-expansion download, verification (grep), patching and installation in incremental steps within the same RUN; use /tmp for packaging then restore /app.
Docker frontend Dockerfile — final image & permissions
docker/frontend/Dockerfile
Adjusted final image COPY sources from builder, set ownership/permissions for public assets and standalone/.next artifacts, ensure /app paths exist, and switch to non-root user after permission fixes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

frontend, docker

Suggested reviewers

  • kasya
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: merging consecutive RUN instructions in the frontend Dockerfile to fix a SonarCloud issue.
Description check ✅ Passed The description is clearly related to the changeset, explaining the SonarCloud issue being fixed and the approach taken to resolve it.
Linked Issues check ✅ Passed The PR successfully addresses issue #3427 by merging consecutive RUN instructions into a single layer using shell chaining, directly meeting the stated objectives.
Out of Scope Changes check ✅ Passed All changes in the Dockerfile are directly related to merging consecutive RUN instructions as specified in issue #3427; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
docker/frontend/Dockerfile (1)

59-77: Merged RUN chain looks correct and well-structured.

The CVE patches, version verification via grep -q, cleanup, and user/group creation are properly chained. The grep -q assertions are a good defensive measure — if a patch silently fails, the build aborts early.

One minor inconsistency: line 66 uses a regex pattern ('version.*7.5.7') while line 75 uses a literal match ('"version": "5.0.1"'). Consider making them consistent for readability.

♻️ Suggested: align both grep patterns to the same style
-    grep -q 'version.*7.5.7' "${TAR_DIR}/package.json" && \
+    grep -q '"version": "7.5.7"' "${TAR_DIR}/package.json" && \

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.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2026
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Please resolve merge conflicts.

@arkid15r arkid15r marked this pull request as draft January 29, 2026 06:31
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 29, 2026
@Shubb07 Shubb07 requested a review from arkid15r January 29, 2026 13:32
@Shubb07 Shubb07 marked this pull request as ready for review January 30, 2026 05:29
@Shubb07
Copy link
Contributor Author

Shubb07 commented Feb 1, 2026

HI @arkid15r , Conflicts have been resolved and the branch was rebased onto main. Please re-review.

Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

Could you resovle the merge conflicts?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docker/frontend/Dockerfile`:
- Line 58: The Dockerfile contains a bare "Note: Must download tar BEFORE
removing the old tar (npm needs it)" line which is not a valid Docker
instruction and causes a DL1000 parse error; update that line to be a proper
Dockerfile comment by prefixing it with "#" (or remove it entirely) so the
parser ignores it and the build no longer fails — look for the literal "Note:
Must download tar BEFORE removing the old tar (npm needs it)" in the Dockerfile
and change it to "# Note: Must download tar BEFORE removing the old tar (npm
needs it)".
🧹 Nitpick comments (1)
docker/frontend/Dockerfile (1)

67-67: Inconsistent version check pattern — use an exact match like line 76.

Line 67 uses the loose pattern 'version.*7.5.7' while line 76 uses the precise '"version": "5.0.1"'. The loose pattern could theoretically match unintended strings. For consistency and robustness, use the same format.

♻️ Proposed fix
-    grep -q 'version.*7.5.7' "${TAR_DIR}/package.json" && \
+    grep -q '"version": "7.5.7"' "${TAR_DIR}/package.json" && \

@Shubb07
Copy link
Contributor Author

Shubb07 commented Feb 7, 2026

Hi @arkid15r , I have resolved merge conflicts. Combined both CVE fixes into a single RUN layer to keep security patches while preserving fewer Docker layers.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 7, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 7, 2026
@Shubb07 Shubb07 requested a review from arkid15r February 7, 2026 20:06
@arkid15r arkid15r enabled auto-merge February 8, 2026 20:37
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2026

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.68%. Comparing base (08adfcc) to head (b34d34d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3644   +/-   ##
=======================================
  Coverage   93.68%   93.68%           
=======================================
  Files         463      463           
  Lines       14419    14419           
  Branches     1939     1939           
=======================================
  Hits        13508    13508           
  Misses        535      535           
  Partials      376      376           
Flag Coverage Δ
backend 95.65% <ø> (ø)
frontend 88.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08adfcc...b34d34d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arkid15r arkid15r added this pull request to the merge queue Feb 8, 2026
Merged via the queue into OWASP:main with commit 674f150 Feb 8, 2026
35 checks passed
arkid15r added a commit that referenced this pull request Feb 10, 2026
* Run make update

* Clean up snapshot generated videos

* Update backend/data/nest.dump

* feat(ui): revamp corporate supporters carousel (Infinite Marquee + Dark Mode fix) (#3837)

* feat(ui): revamp corporate supporters carousel (Infinite Marquee + Dark Mode fix)

* fix: resolve failing test case

* fix: add fallback text for unnamed sponsors

* docs: add docstrings to satisfy coverage requirements

* Run make check and fix tests.

---------

Co-authored-by: Kate <kate@kgthreads.com>

* Fix/redundant typescript assertion (#3834)

* Fix Sonar S4325 by narrowing session user fields instead of casting

* Fix unused ExtendedSession in mentorship page

* fix: redundant-typescript-assertion

* Fix stale latest date displayed in Project Health Dashboard metrics (#3842)

* Fixed latest date in proejct health dashboard

* updated order

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* feat: improve backend test coverage to 96% (#3840)

* feat: improve backend test coverage to 96%

* fix comments

* fix issues

* fix issue

* fix cubic-dev-ai comments

* Update code

* Fix tests

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Fix: merge consecutive RUN instructions in frontend Dockerfile (#3644)

* Fix: merge consecutive RUN instructions in frontend Dockerfile

* fix: comment Dockerfile note to prevent syntax error

* Update code

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Fix 'is_merged' not being available on the Issue (#3843)

* Fix 'is_merged' not being available on the Issue

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* CI:  Add ansible-lint workflow for Ansible playbooks (#3796)

* ci: add ansible-lint workflow

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* Update .github/workflows/lint-ansible.yaml

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* ci: add ansible-lint make target and workflow

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* ci: add ansible-lint pre-commit hook

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* fix: whitespace & version

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* Update Makefile

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* ci: enable ansible-lint scanning and add requirements.yml

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* chore(ansible):align linting and module usage

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* ci(ansible): install collections before deploy playbooks

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* Update code

* Update code

* Update .github/workflows/run-ci-cd.yaml

---------

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Fix ElevenLabs API error (#3861)

* use default liam voice

* bump speed by 0.10

---------

Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Add Ime Iyonsi to MENTORS.md (#3866)

* Add mentor profile for Ime Iyonsi

Added Ime Iyonsi's mentor profile.

* Fix GitHub link for Ime Iyonsi

Corrected GitHub link for Ime Iyonsi.

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>

* Update MENTORS.md

* Enabled Strict Mode (#3776)

* Enabled Strict Mode

* fixed ai review

* fix

* fixed review

* fix

* update test

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Resolve case-sensitivity in QueryParser to support Chapters/Members search (#3844)

* resolve query parser blocker

* use case_sensitive flag in QueryParser

* feat: add case_sensitive option to QueryParser and update tests

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Update dependencies (#3874)

* Update dependencies

* Bump django-ninja version

* fix(proxy): pin nginx and certbot images (#3848)

* fix(proxy): pin nginx and certbot images

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

* fix stable verssions

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>

---------

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* Update docker-compose/proxy/compose.yaml

* Update backend/pyproject.toml

* Update ansible lint configuration (#3880)

* Update .github/ansible/.ansible-lint.yaml

* Improve frontend test coverage above 80% and add missing test files (#3864)

* Imrove test coverage to 80% and added test

* Fixed coderabbit review

* update code

* fixed coderabbit ai

* fixed soanrqube warning

* fixed review

* update

* fixed aloglia cache_key (#3825)

* fixed aloglia cache_key

* change separator val to be semicolon (;)

* Update code

* add tests + use json filters

* add trailing newline

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

* fix: remove unused className prop from AnchorTitle component (#3822)

* fix: remove unused className prop from AnchorTitle component

Fixes #3805

The className prop was defined in AnchorTitleProps but never used
in the component implementation. Removing it resolves Sonar rule
typescript:S6767 and improves code maintainability.

* fix: use className prop instead of removing it

- Added className back to AnchorTitleProps interface
- Accept className parameter in component
- Apply className to root div element
- Resolves reviewer feedback on PR #3822

* Update code

---------

Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>

---------

Signed-off-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
Co-authored-by: Arkadii Yakovets <arkadii.yakovets@owasp.org>
Co-authored-by: Yashraj Pahuja <yashrajpahuja9999@gmail.com>
Co-authored-by: Kate <kate@kgthreads.com>
Co-authored-by: CodeAritraDhank <aritradhank21@gmail.com>
Co-authored-by: Anurag Yadav <143180737+anurag2787@users.noreply.github.com>
Co-authored-by: Harshit Verma <harshit1092004@gmail.com>
Co-authored-by: Arkadii Yakovets <2201626+arkid15r@users.noreply.github.com>
Co-authored-by: Shuban Mutagi <shubanmutagi55@gmail.com>
Co-authored-by: Muhammad Hassaan Saleem <iamhassaans@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: emaybu <152900874+emaybu@users.noreply.github.com>
Co-authored-by: sai chethana <saichethanavesireddy@gmail.com>
Co-authored-by: Rahul Paul <179798584+Mr-Rahul-Paul@users.noreply.github.com>
Co-authored-by: Lavanya <lavanyayadawad30@gmail.com>
@coderabbitai coderabbitai bot mentioned this pull request Feb 19, 2026
4 tasks
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.

SonarQube: Merge consecutive RUN instructions in dockerfile.

2 participants