Metadata-Version: 2.1
Name: poetry-dockerize-plugin
Version: 0.2.0
Summary: Poetry application to Docker, automatically.
Home-page: https://github.com/nicoloboschi/poetry-dockerize-plugin
License: MIT
Keywords: poetry,packaging,docker
Author: Nicolò Boschi
Author-email: boschi1997@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: System :: Archiving :: Packaging
Classifier: Topic :: System :: Installation/Setup
Classifier: Topic :: System :: Software Distribution
Requires-Dist: docker (>=6.1.3,<7.0.0)
Requires-Dist: poetry (>=1.7.1,<2.0.0)
Requires-Dist: poetry-core (>=1.8.1,<2.0.0)
Project-URL: Documentation, https://github.com/nicoloboschi/poetry-dockerize-plugin
Project-URL: Repository, https://github.com/nicoloboschi/poetry-dockerize-plugin
Description-Content-Type: text/markdown

# 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"
python = "3.12"
base-image = "python:3.12-slim"
tags = ["latest-dev"]
entrypoint = ["python", "-m", "whatever"]
ports = [5000]
env = {"MY_APP_ENV" = "dev"}
labels = {"MY_APP_LABEL" = "dev"}
apt-packages = ["curl"]
extra-build-instructions = ["RUN poetry config http-basic.foo <username> <password>"]
extra-run-instructions = ["RUN curl https://huggingface.co/transformers/"]
```

* `name` customizes the docker image name. 
* `python` python version to use. Default is `3.11`
* `base-image` customizes the base image. If not defined, the default base image is `python:<python-version>-slim-buster`. 
* `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.

* `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.
* `apt-packages` installs apt packages inside the docker image.
* `extra-build-instructions` adds extra instructions to the docker build (before poetry install). Any modification to the filesystem will be lost after the poetry install. If you need to add files to the image, use the `extra-run-instructions`.
* `extra-run-instructions` adds extra instructions to the docker run (after poetry install). Any modification to the filesystem will be kept after the poetry install.


## Command-Line options

All command line options provided by the `poetry-dockerize-plugin` may be accessed by typing:

```bash
poetry dockerize --help
```

## License

This project is licensed under the terms of the MIT license.

