This rule ensures that after running yarn install in a Dockerfile, a yarn cache clean command is executed to remove unnecessary cache files. This practice helps to minimize the image size by cleaning up temporary files and caches that are not needed for the runtime environment.
mes.
To comply with this rule, always chain yarn install with yarn cache clean in the same RUN instruction like RUN yarn install && yarn cache clean. This approach ensures that the cache cleanup happens immediately after installation, reducing the number of layers and keeping the image optimized.
Non-Compliant Code Examples
RUN yarn install
Compliant Code Examples
RUN yarn install \
&& yarn cache clean
シームレスな統合。 Datadog Code Security をお試しください
Datadog Code Security
このルールを試し、Datadog Code Security でコードを解析する
このルールの使用方法
1
2
rulesets:- docker-best-practices # Rules to enforce Docker best practices.