Package: poetry-dockerize-plugin
Poetry Dockerize PluginKey features:Automatically generate a docker image from your Poetry application.Highly configurable. You can configure the image by adding a section in thepyproject.tomlconfiguration file.InstallationIn order to install the plugin you need to have installed a poetry version>=1.2.0and type:poetryselfaddpoetry-dockerize-pluginQuickstartNo configuration needed! Just type:poetrydockerize
>Buildingimage:poetry-sample-app:latest
>Successfullybuiltimage:poetry-sample-app:latest
dockerrun--rm-itpoetry-sample-app:latest
>helloworld!Usage in GitHub ActionsYou just need to run the quickstart command in your GitHub Actions workflow:name:Build and publish lateston:push:branches:mainjobs:login:runs-on:ubuntu-lateststeps:-name:Install Poetryuses:snok/install-poetry@v1-name:Install poetry-dockerize-pluginrun:poetry self add poetry-dockerize-plugin-name:Build and packagerun:|poetry installpoetry run pytestpoetry dockerize-name:Login to Docker Hubuses:docker/login-action@v3with:username:${{ secrets.DOCKERHUB_USERNAME }}password:${{ secrets.DOCKERHUB_TOKEN }}-name:Push to Docker Hubrun:docker push my-app:latestConfigurationTo customize some options, you can add a[tool.dockerize]section in yourpyproject.tomlfile. For example to change the image name:[tool.dockerize]name="myself/myproject-app"Configuration API ReferenceThis examples shows a complete configuration of the docker image:[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/"]namecustomizes the docker image name.pythonpython version to use. If not specified, will try to be extracted fromtool.poetry.dependencies.python. Default is3.11base-imagecustomizes the base image. If not defined, the default base image ispython:<python-version>-slim-buster.tagsdeclares a list of tags for the image.entrypointcustomizes the entrypoint of the image. If not provided, the default entrypoint is retrieved from thepackagesconfiguration.portsexposes portsenvdeclares environment variables inside the docker image.labelsappend labels to the docker image. Default labels are added following the opencontainers specification.apt-packagesinstalls apt packages inside the docker image.extra-build-instructionsadds 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 theextra-run-instructions.extra-run-instructionsadds extra instructions to the docker run (after poetry install). Any modification to the filesystem will be kept after the poetry install.Command-Line optionsAll command line options provided by thepoetry-dockerize-pluginmay be accessed by typing:poetrydockerize--helpTroubleshootingTo troubleshoot the plugin, you can use the--debugflag to get more information about the execution.poetrydockerize--debugLicenseThis project is licensed under the terms of the MIT license.