This product is not supported for your selected Datadog site. ().
このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Metadata

ID: docker-best-practices/yarn-clean

Language: Docker

Severity: Warning

Category: Best Practices

Description

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
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

シームレスな統合。 Datadog Code Security をお試しください