-
-
Notifications
You must be signed in to change notification settings - Fork 0
Linting
Nicholas Wilde edited this page Feb 27, 2021
·
10 revisions
My Docker repositories use yamllint and hadolint to lint the repositories.
# Use the Makefile to lint the repository.
$ make lint
# Manually lint
$ yamllint .
# Manually lint
$ hadolint Dockerfile
Pin Package Versions (DL3008)
- Copy the packages list and name of the base image from the
Dockerfile
to variablesPACKAGES
andBASE
respectively inmake.env/task.env
. - Run
make packages/task packages
to list the package versions.
$ task packages-alpine
...
ca-certificates policy:
20191127-r5:
lib/apk/db/installed
http://dl-cdn.alpinelinux.org/alpine/v3.13/main
...
- Copy the package versions from
stdout
over to theDockerfile
.
Similar steps may be taken to pin pip
(DL3013) and npm
(DL3016) packages
Alternatively, a shell
may be launched of the build image and manually run apk policy <package>
or apt-update && apt-cache policy <package>
to get the package versions.
If you want to automatically generate README.md
files with a pre-commit hook, make sure you
install the pre-commit binary, and add a .pre-commit-config.yaml
to your project. Then run:
$ pre-commit install
$ pre-commit install-hooks
Currently, this only works on amd64
systems.
The lint github action is also used to lint the repo upon commit.
Note: This wiki is no longer being updated. See updated documentation https://nicholaswilde.io/docker-docs/