Sign inSign up

biggates/poetry

By biggates

•Updated 4 months ago

python with Poetry

Image
Languages & frameworks
Developer tools
0

3.3K

biggates/poetry repository overview

⁠poetry-docker

2.1.2-py3.13-bookworm badge 2.1.2-py3.13-slim badge 2.1.2-py3.12-bullseye badge 2.1.2-py3.12-slim badge 2.1.2-py3.11-slim badge 2.1.2-py3.10-bullseye badge 2.1.2-py3.10-slim badge⁠ Docker Publish Badge

a Docker image that includes Poetry⁠ for CI/CD pipelines.

⁠Supported tags

  • 2.1.2-py3.13-bookworm
  • 2.1.2-py3.13-slim
  • 2.1.2-py3.12-bullseye
  • 2.1.2-py3.12-slim
  • 2.1.2-py3.11-slim
  • 2.1.2-py3.10-bullseye
  • 2.1.2-py3.10-slim

See versions.json⁠ for further information.

⁠Usage

In your pipeline / actions, replace docker image from python to biggates/poetry, for example:

# FROM python:3.10-slim
FROM biggates/poetry:2.1.2-py3.10-slim

⁠details

Poetry is installed to /root/.local/bin. In case the path fails, use the following line in Dockerfile:

ENV PATH="/root/.local/bin:$PATH"

⁠Usage in multistage builds

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.2-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"]

reference: Blazing fast Python Docker builds with Poetry⁠

Tag summary

Content type

Image

Digest

sha256:a2385adba…

Size

434.3 MB

Last updated

4 months ago

docker pull biggates/poetry:2.2.1-py3.14-bookworm