hadolint github Dockerfileを綺麗にするツール。
sudo wget -O /usr/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.10.0/hadolint-Linux-x86_64
sudo chmod 755 /usr/bin/hadolint
ls
myapp/ pre-commit-setup.sh
hadolint --trusted-registry grc.io ./myapp/Dockerfile # --trusted-registryに登録されているイメージ以外で警告を出す。
./myapp/Dockerfile:1 DL3026 error: Use only an allowed registry in the FROM image
./myapp/Dockerfile:7 DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
- /Dockerfile:7 DL3059 info: Multiple consecutive
RUN
instructions. Consider consolidation. --> RUNを1つにまとめたほうがイメージのレイヤーを最小化できる。