{"id":17464703,"url":"https://github.com/nicoloboschi/poetry-dockerize-plugin","last_synced_at":"2025-03-22T10:10:50.805Z","repository":{"id":208482786,"uuid":"721672768","full_name":"nicoloboschi/poetry-dockerize-plugin","owner":"nicoloboschi","description":"Poetry plugin your Poetry application to a Docker image easily.","archived":false,"fork":false,"pushed_at":"2024-10-14T09:23:18.000Z","size":90,"stargazers_count":73,"open_issues_count":10,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-14T14:04:45.802Z","etag":null,"topics":["docker","poetry","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nicoloboschi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-21T14:39:47.000Z","updated_at":"2025-01-25T09:11:47.000Z","dependencies_parsed_at":"2024-01-29T16:41:11.787Z","dependency_job_id":"d9512262-0ed9-4211-bc77-e41a719e7e42","html_url":"https://github.com/nicoloboschi/poetry-dockerize-plugin","commit_stats":null,"previous_names":["nicoloboschi/poetry-docker-plugin","nicoloboschi/poetry-dockerize-plugin"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicoloboschi%2Fpoetry-dockerize-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicoloboschi%2Fpoetry-dockerize-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicoloboschi%2Fpoetry-dockerize-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicoloboschi%2Fpoetry-dockerize-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicoloboschi","download_url":"https://codeload.github.com/nicoloboschi/poetry-dockerize-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937831,"owners_count":20535127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","poetry","python"],"created_at":"2024-10-18T10:47:04.814Z","updated_at":"2025-03-22T10:10:50.784Z","avatar_url":"https://github.com/nicoloboschi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Poetry Dockerize Plugin\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/poetry-dockerize-plugin/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/poetry-dockerize-plugin?color=green\u0026amp;label=pypi%20package\" alt=\"PyPI\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pepy.tech/project/poetry-dockerize-plugin\"\u003e\n    \u003cimg src=\"https://static.pepy.tech/badge/poetry-dockerize-plugin\" alt=\"Downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/pyversions/poetry-dockerize-plugin?color=green\" alt=\"Py versions\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\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 `\u003e=1.2.0` and type:\n\n```bash\npoetry self add poetry-dockerize-plugin@latest\n```\n\n## Quickstart\n\nNo configuration needed! Just type:\n```bash\npoetry dockerize\n\u003eBuilding image: poetry-sample-app:latest\n\u003eSuccessfully built image: poetry-sample-app:latest\ndocker run --rm -it poetry-sample-app:latest\n\u003ehello 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@latest\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 via pyproject.toml\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 via environment variables\nYou can also pass any option via environment variable by prefixing the key with `DOCKERIZE_`. For example, to set the `entrypoint` you can use the `DOCKERIZE_ENTRYPOINT` environment variable:\n\n```bash\nexport DOCKERIZE_ENTRYPOINT=\"python -m myapp\"\npoetry dockerize\n```\n\nor use a .env file which will be loaded by the plugin:\n```\necho \"DOCKERIZE_ENTRYPOINT=python -m myapp\" \u003e .env\npoetry dockerize\n```\n\nFor dicts such as `env` and `labels`, you can set multiple values by adding multiple variables:\n\n```bash\nexport DOCKERIZE_ENV_MY_VAR=\"my_value\"\nexport DOCKERIZE_ENV_MY_OTHER_VAR=\"my_other_value\"\nexport DOCKERIZE_LABELS_MY_LABEL=\"label1\"\npoetry dockerize\n```\n\n\n## Configuration API Reference\n\nThis examples shows a complete configuration of the docker image:\n\n```toml\n[tool.dockerize]\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-run-instructions = [\"RUN curl https://huggingface.co/transformers/\"]\n\n# Only for build docker layer\nbuild-apt-packages = [\"gcc\"]\nextra-build-instructions = [\"RUN poetry config http-basic.foo \u003cusername\u003e \u003cpassword\u003e\"]\nbuild-poetry-install-args = [\"-E\", \"all\", \"--no-root\"]\n\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:\u003cpython-version\u003e-slim-bookworm`. \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-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\nFor the build step:\n* `build-apt-packages` installs apt packages inside the build docker container.\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* `build-poetry-install-args` adds additional arguments to the `poetry install` command in the build step.\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## Generate Dockerfile\n\nTo only generate the Dockerfile, you can use the `--generate` flag.\n\n```bash\npoetry dockerize --generate\n```\n\nThen you can store the Dockerfile on the repository and use it as a template and customize it as you need. \n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicoloboschi%2Fpoetry-dockerize-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicoloboschi%2Fpoetry-dockerize-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicoloboschi%2Fpoetry-dockerize-plugin/lists"}