Dead simple basic Python TDD application skeleton with Docker
Add all dependencies to requirements.txt
Optional: Replace all instances of 'app' with your application name
- Start the Docker application
- Within the container, run
pip install -r requirements.txt
- Run app.hello module with
python -m pyapp
. This will all the code inside__main__.py
- Create a new function inside a new file within
pyapp/
- Create a new unit test for your function with a name that follows the
*_test.py
pattern - Run all unit tests locally with
python -m unittest discover tests "*_test.py"
- Build the docker image for unit tests with
docker build -t python_docker_example:version1.0.test --target test .
- Run the unit tests docker image with
docker run python_docker_example:version1.0.test
- Build the docker image for the development build
docker build -t python_docker_example:version1.0.build --target build .
- Run the development docker image with
docker run python_docker_example:version1.0.build