You can find more information about this project/repository and how to use it in following blog post:
To use this repository as starter for your project you can run configure_project.sh
script, which sets up all variables and file names. This way you can avoid configuring and renaming things yourself:
./configure_project.sh MODULE="coolproject" REGISTRY="docker.pkg.github.com/martinheinz/repo-name"
~ $ make run
Development image:
~ $ make build-dev
~ $ docker images --filter "label=name=blueprint"
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.pkg.github.com/martinheinz/python-project-blueprint/blueprint 3492a40-dirty acf8d09acce4 28 seconds ago 967MB
~ $ docker run acf8d09acce4
Hello World...
Production (Distroless) image:
~ $ make build-prod VERSION=0.0.5
~ $ docker images --filter "label=version=0.0.5"
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.pkg.github.com/martinheinz/python-project-blueprint/blueprint 0.0.5 65e6690d9edd 5 seconds ago 86.1MB
~ $ docker run 65e6690d9edd
Hello World...
Test are ran every time you build dev or prod image. You can also run tests using:
~ $ make test
~ $ docker login docker.pkg.github.com --username MartinHeinz
Password: ...
...
Login Succeeded
~ $ make push VERSION=0.0.5
Clean Pytest and coverage cache/files:
~ $ make clean
Clean Docker images:
~ $ make docker-clean
- Navigate to https://sonarcloud.io/projects
- Click plus in top right corner -> analyze new project
- Setup with other CI tool -> other -> Linux
- Copy
-Dsonar.projectKey=
and-Dsonar.organization=
- These 2 values go to
sonar-project.properties
file
- These 2 values go to
- Click pencil at bottom of
sonar-scanner
command - Generate token and save it
- Go to repo -> Settings tab -> Secrets -> Add a new secret
- name:
SONAR_TOKEN
- value: Previously copied token
- name:
Token is needed for example for GitHub Package Registry. To create one:
- Go to Settings tab
- Click Secrets
- Click Add a new secret
- Name: name that will be accessible in GitHub Actions as
secrets.NAME
- Value: value
- Name: name that will be accessible in GitHub Actions as
- https://realpython.com/python-application-layouts/
- https://dev.to/codemouse92/dead-simple-python-project-structure-and-imports-38c6
- https://github.com/navdeep-G/samplemod/blob/master/setup.py
- https://github.com/GoogleContainerTools/distroless/blob/master/examples/python3/Dockerfile