Simple Docker pipeline to test your python code.
In this repo i've add a very basic python project with only four elements: a requirements file, a Dockerfile, a pytest.ini file and a simple python test that always pass.
You can put several stages to your pipeline, but the most common stages are: Build, Test, Lint, Report, Tag.
- Build: Downloads and build dependencies.
- Test: Executes all tests found.
- Lint: Checks code style and bad code practicies.
- Report: Formats and exports the results to archiving.
- Tag: Adds a unique identifier to the version making it ready to release.
-
Clone or download this repository.
-
Move your code to this new structure or vice versa.
-
Make sure the
Dockerfile
is on project root folder. -
Update the requiments with your dependencies or create your list of requirements. See the dependencies tutorial to more details.
-
Make sure the name patterns on
pytest.ini
-
Make sure you have at least one passing test (there's one in test-pass.py)
-
In
Dockerfile
rename thesrc
folder following your project organizaziton.
Execute the docker build command
docker build -t your-docker-user/projetc-name:tag .
If every step works correctly the command docker images
is going to list your newly created image.
If something goes wrong youll be promptly warned.