Dockerfile892 bytes written ▸text33 lines · 892 chars
FROM python:3.11-slim
# Create a lightweight, Python-friendly image that can build Poetry from source.
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install system dependencies required for building Python wheels
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
gcc \
libffi-dev \
libssl-dev \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy source and build from source
WORKDIR /src
COPY . /src
# Build the project from source and install the resulting wheel
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install --no-cache-dir --upgrade build \
&& python -m build
RUN python -m pip install --no-cache-dir dist/poetry-*.whl
# Default command: show Poetry version to verify installation
CMD ["poetry", "--version"]