Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONARIAC-1701 Update RSPEC description for S6587 #4562

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions rules/S6587/docker/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,20 @@ They are not removed by the `clean` command, so they need to be removed manually
Alternatively, store the cache in a dedicated cache mount. A cache mount can be created by adding a flag `--mount type=cache` to the `RUN` command. +
This will store the cache in a Docker volume, which will be persisted between builds making the build faster.

Also, each `RUN` instruction creates a new layer, and any changes made in one layer are not visible in the next. Thus, the cache should be removed in the same layer (i.e., the same `RUN` instruction) as the installation.

The following code incorrectly cleans the cache:
[source,docker]
----
RUN apt-get install nginx
RUN apt-get clean
----
It should be written as:
[source,docker]
----
RUN apt-get install nginx && apt-get clean
----

== Resources
=== Documentation

Expand Down
Loading