A Docker image that runs RepoLinter (https://github.com/todogroup/repolinter/) against a repo.
66
A Docker image that runs RepoLinter against a repository.
The basic linting attempts to be uncontroversial and only includes very basic rules. Details are provided below to build out more specific rulesets for an organisation or collection of projects.
The basic rules are that:
README must be present;The working directory in the image is /repolinter/repo, which is where the host directory to be checked should be mapped to.
To lint the 'current' repo (i.e., the current working directory) using Docker, run:
docker run --rm -it -v ${PWD}:/repolinter/repo markbirbeck/repolinter
To lint the 'current' repo using Docker Compose, set up a docker-compose.yml file that includes the following:
version: "3.2"
services:
repolinter:
image: markbirbeck/repolinter
volumes:
- .:/repolinter/repo
and then run:
docker-compose run repolinter
The configuration file is located in the directory above the repo to be checked (i.e., /repolinter), so that it doesn't interfere with whatever is being linted. If there is a repolint.json file in the current directory then repolinter will pick it up, but ideally the config should not be part of the project being checked--the rules that a repo must adhere to should be externally enforced.
The quickest way to achieve this is to create a config file based on the default ruleset, and then to map it into a running container:
docker run --rm -it \
-v ${PWD}:/repolinter/repo \
-v /path/to/my/repolint.json:/repolinter/repolint.json \
markbirbeck/repolinter
However, if you have a policy that must be enforced across a number of repos within your company or organisation then another model is to create a Docker image that includes the config. Your Dockerfile might look something like this:
FROM markbirbeck/repolinter
LABEL maintainer="[email protected]"
LABEL version="0.1.0"
# Copy in custom configuration:
#
COPY repolint.json /repolinter/
You now have a Docker image that will enforce your policy, and that can be shared and used in CI/CD processes.
See the examples directory for files to modify. And see my repolinter for an example of an image based on this one, but with custom rules.
Content type
Image
Digest
Size
46.6 MB
Last updated
over 8 years ago
docker pull markbirbeck/docker-repolinter