Cookiecutter template for a dockerized dev-ops pipeline with SonarQube code quality monitoring
Cookiecutter template for a dockerized dev-ops pipeline with SonarQube code-quality monitoring.
Cookiecutter provides a command-line interface for creating projects from templates.
The template provides a minimal dev-ops pipeline that supports:
The dev-ops pipeline is mostly implemented in a Makefile
and a Dockerfile
which are
independent of your Python code.
Install the latest cookiecutter:
pip install -U cookiecutter
Generate an instance of the template:
cookiecutter https://github.com/lrothack/cookiecutter-pydevops.git
Then switch to the project directory and:
make help
in order to get an overview of the targets provided by Makefile
.make install-dev
in order to install the package (and all dependencies) in development mode.make lint
in order to run code analysis with pylint and bandit.make test
in order to run unit tests with pytest and coverage.make dist
in order to build a Python package (binary and source).docker-compose -p sonarqube -f sonarqube/docker-compose.yml up -d
in order to start a SonarQube server.make sonar
in order to run sonar-scanner
and report results to your local SonarQube server. Make sure to create a SonarQube authentication token before. Save the token in the file .sonartoken
within your project directory.make docker-build
in order to analyze, test, package and deploy in a multi-stage Docker build. Test your docker image with docker run
.Advanced configurations can be made in the configuration sections of Makefile
. See lrothack/dev-ops for more information.