chore: Migrate from Poetry to uv, bump dependencies and python version.

This commit is contained in:
Elisiário Couto
2025-01-13 21:12:04 +00:00
parent 6b2cb8a52f
commit 33006f8f43
7 changed files with 419 additions and 612 deletions

View File

@@ -1,14 +1,19 @@
FROM python:3.12-alpine as builder
ARG POETRY_VERSION="1.7.1"
FROM python:3.13-alpine AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
RUN apk add --no-cache gcc libffi-dev musl-dev && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -q poetry=="${POETRY_VERSION}"
COPY . .
RUN poetry config virtualenvs.create false && poetry build -f wheel
FROM python:3.12-alpine
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project --no-editable
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-editable
FROM python:3.13-alpine
LABEL org.opencontainers.image.source="https://github.com/elisiariocouto/leggen"
LABEL org.opencontainers.image.authors="Elisiário Couto <elisiario@couto.io>"
@@ -17,8 +22,8 @@ LABEL org.opencontainers.image.title="leggen"
LABEL org.opencontainers.image.description="An Open Banking CLI"
LABEL org.opencontainers.image.url="https://github.com/elisiariocouto/leggen"
WORKDIR /app
COPY --from=builder /app/dist/ /app/
RUN pip --no-cache-dir install leggen*.whl && \
rm leggen*.whl
ENTRYPOINT ["/usr/local/bin/leggen"]
# Copy the environment, but not the source code
COPY --from=builder --chown=app:app /app/.venv /app/.venv
# Run the application
ENTRYPOINT ["/app/.venv/bin/leggen"]