2.2.1-py3.13-bookworm badge 2.2.1-py3.13-slim badge 2.2.1-py3.12-bookworm badge 2.2.1-py3.12-slim badge 2.2.1-py3.11-bookworm badge 2.2.1-py3.11-slim badge 2.2.1-py3.10-bookworm badge 2.2.1-py3.10-slim badge Docker Publish Badge
a Docker image that includes Poetry for CI/CD pipelines.
2.2.1-py3.13-bookworm2.2.1-py3.13-slim2.2.1-py3.12-bookworm2.2.1-py3.12-slim2.2.1-py3.11-bookworm2.2.1-py3.11-slim2.2.1-py3.10-bookworm2.2.1-py3.10-slim
See versions.json for further information.
In your pipeline / actions, replace docker image from python to biggates/poetry, for example:
# FROM python:3.10-slim FROM biggates/poetry:2.1.4-py3.10-slim
Poetry is installed to /root/.local/bin. In case the path fails, use the following line in Dockerfile:
ENV PATH="/root/.local/bin:$PATH"
A typical usage is use poetry to install all the dependencies in one stage, and copy the whole venv to another stage and use it.
# first stage FROM biggates/poetry:2.1.4-py3.10-slim as venv-creator ENV POETRY_NO_INTERACTION=1 \ POETRY_VIRTUALENVS_IN_PROJECT=1 \ POETRY_VIRTUALENVS_CREATE=1 \ POETRY_CACHE_DIR=/tmp/poetry_cache WORKDIR /app # add poetry managed dependencies ADD poetry.lock poetry.toml pyproject.toml README.md ./ # let poetry create the venv RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install # second stage FROM python:3.10-slim as runtime # activate the venv ENV VIRTUAL_ENV=/app/.venv \ PATH="/app/.venv/bin:$PATH" WORKDIR /app # copy the previously created venv COPY --from=venv-creator ${VIRTUAL_ENV} ${VIRTUAL_ENV} # add current project files COPY . /app # rest of your dockerfile CMD ["python", "myscript.py"]