Dockerfile30 lines · 795 chars FROM python:3.14-alpine3.23 AS builder
WORKDIR /work
# Build-time dependencies: compiler and Python build tools
RUN apk add --no-cache --virtual .build-deps build-base libffi-dev openssl-dev && \
python -m pip install --upgrade pip && \
python -m pip install build poetry-core==2.4.0
# Copy the project sources and build the wheel
COPY . .
RUN python -m build
# Final runtime image
FROM python:3.14-alpine3.23
ENV PYTHONUNBUFFERED=1
# Runtime dependencies
RUN apk add --no-cache libffi openssl
WORKDIR /poetry
# Copy built wheel from the builder stage and install it
COPY --from=builder /work/dist/poetry-2.4.1-py3-none-any.whl /tmp/poetry-2.4.1-py3-none-any.whl
RUN python -m pip install /tmp/poetry-2.4.1-py3-none-any.whl
# Basic validation
RUN poetry --version
CMD ["poetry"]