Something went wrong. Try again.
Robust, lightweight, configurable python-poetry Docker images for any use case.
Something went wrong. Try again.
docker-python-poetry Dockerfile
1.8 kB · 41 lines
Dockerfile
at master
1234567891011121314151617181920212223242526272829303132333435363738394041# Copyright (c) 2022 Joseph Hale# # This software is released under the MIT License.# https://opensource.org/licenses/MIT
# Default to the latest slim version of PythonARG PYTHON_IMAGE_TAG=slim
################################################################################ POETRY BASE IMAGE - Provides environment variables for poetry###############################################################################FROM python:${PYTHON_IMAGE_TAG} AS python-poetry-base# Default to the latest version of PoetryARG POETRY_VERSION=""
ENV POETRY_VERSION=${POETRY_VERSION}ENV POETRY_HOME="/opt/poetry"ENV POETRY_VIRTUALENVS_IN_PROJECT=trueENV POETRY_NO_INTERACTION=1
ENV PATH="$POETRY_HOME/bin:$PATH"
################################################################################ POETRY BUILDER IMAGE - Installs Poetry and dependencies###############################################################################FROM python-poetry-base AS python-poetry-builderRUN apt-get update \ && apt-get install --no-install-recommends --assume-yes curl# Install Poetry via the official installer: https://python-poetry.org/docs/master/#installing-with-the-official-installer# This script respects $POETRY_VERSION & $POETRY_HOMERUN curl -sSL https://install.python-poetry.org | python3 -
################################################################################ POETRY RUNTIME IMAGE - Copies the poetry installation into a smaller image###############################################################################FROM python-poetry-base AS python-poetryCOPY --from=python-poetry-builder $POETRY_HOME $POETRY_HOMERUN groupadd --gid 1000 nonroot \ && useradd --uid 1000 --gid 1000 --no-create-home --shell /bin/bash nonroot