poetry-dockerize-plugin


Namepoetry-dockerize-plugin JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/nicoloboschi/poetry-dockerize-plugin
SummaryPoetry application to Docker, automatically.
upload_time2024-01-31 21:31:36
maintainer
docs_urlNone
authorNicolò Boschi
requires_python>=3.9,<4.0
licenseMIT
keywords poetry packaging docker
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Poetry Dockerize Plugin

<p align="center">
  <a href="https://pypi.org/project/poetry-dockerize-plugin/">
    <img src="https://img.shields.io/pypi/v/poetry-dockerize-plugin?color=green&amp;label=pypi%20package" alt="PyPI">
  </a>
  <a href="https://pepy.tech/project/poetry-dockerize-plugin">
    <img src="https://static.pepy.tech/badge/poetry-dockerize-plugin" alt="Downloads">
  </a>
  <a href="">
    <img src="https://img.shields.io/pypi/pyversions/poetry-dockerize-plugin?color=green" alt="Py versions">
  </a>
</p>


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!
```

### Usage in GitHub Actions
You just need to run the quickstart command in your GitHub Actions workflow:
```yaml

name: Build and publish latest

on:
  push:
    branches: main

jobs:
  login:
    runs-on: ubuntu-latest
    steps:
        - name: Install Poetry
          uses: snok/install-poetry@v1

        - name: Install poetry-dockerize-plugin
          run: poetry self add poetry-dockerize-plugin

        - name: Build and package
          run: |
            poetry install
            poetry run pytest
            poetry dockerize

        - name: Login to Docker Hub
          uses: docker/login-action@v3
          with:
            username: ${{ secrets.DOCKERHUB_USERNAME }}
            password: ${{ secrets.DOCKERHUB_TOKEN }}

        - name: Push to Docker Hub
          run: docker push my-app:latest
```

## 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. If not specified, will try to be extracted from `tool.poetry.dependencies.python`. 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
```

## Troubleshooting

To troubleshoot the plugin, you can use the `--debug` flag to get more information about the execution.

```bash
poetry dockerize --debug
```

## License

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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nicoloboschi/poetry-dockerize-plugin",
    "name": "poetry-dockerize-plugin",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "poetry,packaging,docker",
    "author": "Nicol\u00f2 Boschi",
    "author_email": "boschi1997@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ce/a3/fd2c69231d816430d5f0dcd506c72ef665c54a561349dc5078287ccdd99c/poetry_dockerize_plugin-0.4.0.tar.gz",
    "platform": null,
    "description": "# Poetry Dockerize Plugin\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/poetry-dockerize-plugin/\">\n    <img src=\"https://img.shields.io/pypi/v/poetry-dockerize-plugin?color=green&amp;label=pypi%20package\" alt=\"PyPI\">\n  </a>\n  <a href=\"https://pepy.tech/project/poetry-dockerize-plugin\">\n    <img src=\"https://static.pepy.tech/badge/poetry-dockerize-plugin\" alt=\"Downloads\">\n  </a>\n  <a href=\"\">\n    <img src=\"https://img.shields.io/pypi/pyversions/poetry-dockerize-plugin?color=green\" alt=\"Py versions\">\n  </a>\n</p>\n\n\nKey features:\n\n* Automatically generate a docker image from your Poetry application.\n* Highly configurable. You can configure the image by adding a section in the `pyproject.toml` configuration file.\n\n## Installation\n\nIn order to install the plugin you need to have installed a poetry version `>=1.2.0` and type:\n\n```bash\npoetry self add poetry-dockerize-plugin\n```\n\n## Quickstart\n\nNo configuration needed! Just type:\n```bash\npoetry dockerize\n>Building image: poetry-sample-app:latest\n>Successfully built image: poetry-sample-app:latest\ndocker run --rm -it poetry-sample-app:latest\n>hello world!\n```\n\n### Usage in GitHub Actions\nYou just need to run the quickstart command in your GitHub Actions workflow:\n```yaml\n\nname: Build and publish latest\n\non:\n  push:\n    branches: main\n\njobs:\n  login:\n    runs-on: ubuntu-latest\n    steps:\n        - name: Install Poetry\n          uses: snok/install-poetry@v1\n\n        - name: Install poetry-dockerize-plugin\n          run: poetry self add poetry-dockerize-plugin\n\n        - name: Build and package\n          run: |\n            poetry install\n            poetry run pytest\n            poetry dockerize\n\n        - name: Login to Docker Hub\n          uses: docker/login-action@v3\n          with:\n            username: ${{ secrets.DOCKERHUB_USERNAME }}\n            password: ${{ secrets.DOCKERHUB_TOKEN }}\n\n        - name: Push to Docker Hub\n          run: docker push my-app:latest\n```\n\n## Configuration\nTo customize some options, you can add a `[tool.dockerize]` section in your `pyproject.toml` file. For example to change the image name:\n\n```toml\n[tool.dockerize]\nname = \"myself/myproject-app\"\n```\n\n## Configuration API Reference\n\nThis examples shows a complete configuration of the docker image:\n\n```toml\n[tool.docker]\nname = \"alternative-image-name\"\npython = \"3.12\"\nbase-image = \"python:3.12-slim\"\ntags = [\"latest-dev\"]\nentrypoint = [\"python\", \"-m\", \"whatever\"]\nports = [5000]\nenv = {\"MY_APP_ENV\" = \"dev\"}\nlabels = {\"MY_APP_LABEL\" = \"dev\"}\napt-packages = [\"curl\"]\nextra-build-instructions = [\"RUN poetry config http-basic.foo <username> <password>\"]\nextra-run-instructions = [\"RUN curl https://huggingface.co/transformers/\"]\n```\n\n* `name` customizes the docker image name. \n* `python` python version to use. If not specified, will try to be extracted from `tool.poetry.dependencies.python`. Default is `3.11`\n* `base-image` customizes the base image. If not defined, the default base image is `python:<python-version>-slim-buster`. \n* `tags` declares a list of tags for the image.\n* `entrypoint` customizes the entrypoint of the image. If not provided, the default entrypoint is retrieved from the `packages` configuration.\n* `ports` exposes ports\n* `env` declares environment variables inside the docker image.\n* `labels` append labels to the docker image. Default labels are added following the opencontainers specification.\n* `apt-packages` installs apt packages inside the docker image.\n* `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`.\n* `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.\n\n\n## Command-Line options\n\nAll command line options provided by the `poetry-dockerize-plugin` may be accessed by typing:\n\n```bash\npoetry dockerize --help\n```\n\n## Troubleshooting\n\nTo troubleshoot the plugin, you can use the `--debug` flag to get more information about the execution.\n\n```bash\npoetry dockerize --debug\n```\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Poetry application to Docker, automatically.",
    "version": "0.4.0",
    "project_urls": {
        "Documentation": "https://github.com/nicoloboschi/poetry-dockerize-plugin",
        "Homepage": "https://github.com/nicoloboschi/poetry-dockerize-plugin",
        "Repository": "https://github.com/nicoloboschi/poetry-dockerize-plugin"
    },
    "split_keywords": [
        "poetry",
        "packaging",
        "docker"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "932729d4e274b43bdd498d6351b02f373e0f9c1aaf48dd333da1ce3b9cbe0bcf",
                "md5": "207d87b2f6cf68eefb1ed6aacb094d34",
                "sha256": "78438aed6b52afc22a3c08c6151747c699ab4b24308adb49355318b98b3de35d"
            },
            "downloads": -1,
            "filename": "poetry_dockerize_plugin-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "207d87b2f6cf68eefb1ed6aacb094d34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 8155,
            "upload_time": "2024-01-31T21:31:35",
            "upload_time_iso_8601": "2024-01-31T21:31:35.075723Z",
            "url": "https://files.pythonhosted.org/packages/93/27/29d4e274b43bdd498d6351b02f373e0f9c1aaf48dd333da1ce3b9cbe0bcf/poetry_dockerize_plugin-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cea3fd2c69231d816430d5f0dcd506c72ef665c54a561349dc5078287ccdd99c",
                "md5": "453dcb2604b4c9ba6984f53afa60364f",
                "sha256": "dcf1bf77b05a8ee1d406d91181969b527385499fabcf0098f19b62058099a46c"
            },
            "downloads": -1,
            "filename": "poetry_dockerize_plugin-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "453dcb2604b4c9ba6984f53afa60364f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 6873,
            "upload_time": "2024-01-31T21:31:36",
            "upload_time_iso_8601": "2024-01-31T21:31:36.650923Z",
            "url": "https://files.pythonhosted.org/packages/ce/a3/fd2c69231d816430d5f0dcd506c72ef665c54a561349dc5078287ccdd99c/poetry_dockerize_plugin-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-31 21:31:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nicoloboschi",
    "github_project": "poetry-dockerize-plugin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "poetry-dockerize-plugin"
}
        
Elapsed time: 0.17320s