-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0aa833e
commit 9f0a542
Showing
4 changed files
with
104 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,72 @@ | ||
# poetry-dockerize-plugin | ||
Package your Poetry application to a Docker image without configuration. It just works. | ||
# Poetry Dockerize Plugin | ||
|
||
``` | ||
![PyPI](https://img.shields.io/pypi/v/poetry-dockerize-plugin?color=green&label=pypi%20package) | ||
![PyPI](https://img.shields.io/pypi/pyversions/poetry-dockerize-plugin?color=gree) | ||
|
||
Key features: | ||
|
||
* Automatically generate a docker image from your Poetry application. | ||
* Highly configurable. You can configure the image by adding a section in the `pyproject.toml` configuration file. | ||
|
||
## Installation | ||
|
||
In order to install the plugin you need to have installed a poetry version `>=1.2.0` and type: | ||
|
||
```bash | ||
poetry self add poetry-dockerize-plugin | ||
``` | ||
|
||
## Quickstart | ||
|
||
No configuration needed! Just type: | ||
```bash | ||
poetry dockerize | ||
>Building image: poetry-sample-app:latest | ||
>Successfully built image: poetry-sample-app:latest | ||
docker run --rm -it poetry-sample-app:latest | ||
>hello world! | ||
``` | ||
|
||
## Configuration | ||
To customize some options, you can add a `[tool.dockerize]` section in your `pyproject.toml` file. For example to change the image name: | ||
|
||
```toml | ||
[tool.dockerize] | ||
name = "myself/myproject-app" | ||
``` | ||
|
||
## Configuration API Reference | ||
|
||
This examples shows a complete configuration of the docker image: | ||
|
||
```toml | ||
[tool.docker] | ||
name = "alternative-image-name" | ||
tags = ["latest-dev"] | ||
entrypoint = ["python", "-m", "whatever"] | ||
python = "3.8" | ||
ports = [5000] | ||
env = {"MY_APP_ENV" = "dev"} | ||
labels = {"MY_APP_LABEL" = "dev"} | ||
``` | ||
|
||
* `name` customizes the docker image name. | ||
* `tags` declares a list of tags for the image. | ||
* `entrypoint` customizes the entrypoint of the image. If not provided, the default entrypoint is retrieved from the `packages` configuration. | ||
* `python` python version to use. Default is `3.11` | ||
* `ports` exposes ports | ||
* `env` declares environment variables inside the docker image. | ||
* `labels` append labels to the docker image. Default labels are added following the opencontainers specification. | ||
|
||
|
||
## Command-Line options | ||
|
||
All command line options provided by the `poetry-dockerize-plugin` may be accessed by typing: | ||
|
||
```bash | ||
poetry dockerize --help | ||
``` | ||
|
||
cd your-application | ||
poetry dockerize | ||
$ ... | ||
$ Image built! | ||
## License | ||
|
||
``` | ||
This project is licensed under the terms of the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
[tool.poetry] | ||
name = "poetry-dockerize-plugin" | ||
version = "0.1.0" | ||
description = "Package your Poetry application to a Docker image automatically." | ||
description = "Poetry application to Docker, automatically." | ||
authors = ["Nicolò Boschi <[email protected]>"] | ||
license = "MIT" | ||
readme = "README.md" | ||
keywords = ["poetry", "packaging", "docker"] | ||
repository = "https://github.com/nicoloboschi/poetry-dockerize-plugin" | ||
documentation = "https://github.com/nicoloboschi/poetry-dockerize-plugin" | ||
classifiers = [ | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Information Technology", | ||
"Intended Audience :: System Administrators", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Topic :: Software Development", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Topic :: Software Development :: Libraries :: Application Frameworks", | ||
"Topic :: Software Development :: Version Control :: Git", | ||
"Topic :: System :: Archiving :: Packaging", | ||
"Topic :: System :: Installation/Setup", | ||
"Topic :: System :: Software Distribution", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"License :: OSI Approved :: MIT License" | ||
] | ||
packages = [ | ||
{include = "poetry_dockerize_plugin", from = "."} | ||
] | ||
|
||
|
||
[tool.poetry.plugins."poetry.application.plugin"] | ||
dockerize = "poetry_dockerize_plugin.plugin:DockerApplicationPlugin" | ||
|
||
|
@@ -18,7 +42,6 @@ python = "^3.9" | |
poetry = "^1.7.1" | ||
poetry-core = "^1.8.1" | ||
docker = "^6.1.3" | ||
pytest = "^7.4.4" | ||
|
||
|
||
[tool.poetry.group.test.dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters