Python Poetry is a dependency management tool for Python projects. It provides several key features that help streamline the management of project dependencies such as dependency resolution and management, reproducibility, environment management, environment isolation including the provisioning of virtual environments for managing project dependencies.
Docker is a platform that simplifies the process of creating, deploying, and running applications using containers. Containers package an application and its dependencies into a standardized unit that can run consistently across different environments, promoting portability and efficiency.
Multistage Docker builds are a feature that allows you to use multiple FROM statements within a single Dockerfile, effectively creating different build stages. Each stage can use a different base image and serve a specific purpose like building the application, running tests, or preparing the final runtime environment.
curl -sSL https://install.python-poetry.org | python3
export PATH="/Users/sushantjoshi/.local/bin:$PATH"
poetry --version
poetry new demo_app --name src
poetry add pytest httpx isort black --group dev
poetry shell
poetry run pytest
poetry run black .
poetry run isort .
docker build -t demo .
docker build --no-cache -t demo --target test .
docker images demo
docker run -it --rm demo