Just a practice field for making, linting, testing and describing python projects and setting CI/CD for it.
Here is a Docker image that runs FastAPI server with two simple get and post methods.
Добавить правила для коммитов:
- мануал шаг с деплоем на тест
- мануал шаг с деплоем на прод
- Добавить test coverage
- Описать все, что происходит в репо в шапке
- python ~3.10
Clone repo first:
git clone [email protected]:alexnazarv/training-project-api.git
Install poetry:
pip install poetry==1.5.1
Move to project directory and make a venv:
cd training-project-api && poetry shell
Install dependencies and run the app:
poetry install && poetry run python3 -m app.main
Build image and run container:
docker build . -t apicontainer -t apicontainer:test &&
docker run -d --rm --name apicontainer -p 8000:8000 apicontainer:test &&
docker rmi $(docker images -f "dangling=true" -q)
Clean up container and image:
docker rm -f apicontainer &&
docker rmi $(docker images apicontainer -q) -f
poetry run python3 -m pytest --cov=app
poetry run flake8 . && mypy . && isort .