Skip to content

cvisionai/poetry-docker-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poetry-docker-example

An example project using Poetry inside a docker environment inspired by this Dockerfile.

Prerequisites

This assumes make, Python 3.10+, and Poetry are installed.

Local development

After cloning this repository, install all dependencies (production and development) locally with make dev-install. This will run poetry install --no-root --all-extras if poetry is found on the system. Next, make dev-run will run the server locally, instead of in a docker container. This make target will run the code cd src && poetry run uvicorn main:app.

Why?

This allows a developer to add dependencies to a project by either editing the pyproject.toml file directly or running poetry add <package>.

Building and running docker images for production

To build for and run in production, the project and its dependencies can be packaged in a docker image. Running make build will build the docker image (docker build -t poetry_docker:latest .), while make rebuild will add the --no-cache flag and build from scratch. Running make run will start a docker container running the latest build of poetry_docker on the host network (docker run --rm -it --net=host poetry_docker:latest), type Ctrl+C to stop the container.

About

An example project using Poetry inside a docker environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published