This repository provides a simple way to dockerize an, also simple, validator
for CITATION.cff
files in the Citation File Format.
If you have Docker installed, you can validate your CITATION.cff
file as follows:
docker build -t cffvalidator \
https://raw.githubusercontent.com/sdruskat/cff-validator-docker/1.0.0/Dockerfile
# Display help
docker run --rm cffvalidator --help
# Validate CITATION.cff file
docker run --rm -v </absolute/path/to/your/CITATION.cff>:/cff/CITATION.cff cffvalidator
If the validation output (which comes from jsonschema
by the way) is too verbose,
search it for lines starting with jsonschema.exceptions.ValidationError
. These usually contain the best hints.
The Dockerfile
is where the "magic" happens, but it isn't really magic.
Here is what really happens:
- Define the base layer (here: a newer Python 3)
- Set the working directory (
/code
) - Add the
requirements.txt
file containing the Python dependencies to the working directory - Install the Python dependencies from
requirements.txt
withpip
- Add the latest main version of the Python 3 script we use in the Citation File Format project to validate
CITATION.cff
files during testing to the working directory - Add the latest main version of the Citation File Format JSON Schema file to the working directory
- Provide an "entrypoint" to the container, which sets all the arguments
When running the container to validate a CFF file,
you do the heavy lifting yourself by mounting the local file into the container, using docker run -v localfile:mounttarget
.
If you want to contribute to this project, please open an issue first. Contributions are accepted via pull requests. Thanks!
This work is licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication license.