From 812802361a441c3f339fd6fcc3e766678e820010 Mon Sep 17 00:00:00 2001 From: Urvish Date: Fri, 30 Oct 2026 12:18:30 +0530 Subject: [PATCH] build(docker): speed up builds with uv package manager and BuildKit cache - Prefer IPv4 in gai.conf to prevent PyPI timeouts - Use Astral's uv for faster dependency installation - Enable BuildKit cache mount to reuse downloaded wheels --- .git_api_info | 4 ++-- Dockerfile | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.git_api_info b/.git_api_info index 896df23..229fe4d 100644 --- a/.git_api_info +++ b/.git_api_info @@ -1,2 +1,2 @@ -Branch: invoice-update -Commit: 50538bb64faa7f46d643ed60b9f0f272d5624a39 +Branch: main +Commit: 895342a8ba976caa41f4b5b9fdec1c684e47dc5d diff --git a/Dockerfile b/Dockerfile index 003c2fb..85350ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* -# Copy pyproject.toml first for layer caching +# Prefer IPv4 over unrouted IPv6 in glibc to prevent PyPI connection timeouts +RUN echo "precedence ::ffff:0:0/96 100" >> /etc/gai.conf + +# Use Astral's uv package manager for fast, parallel, cached installations +COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv +ENV UV_HTTP_TIMEOUT=300 + +# Copy pyproject.toml first COPY pyproject.toml ./ COPY README.md ./ @@ -26,8 +33,8 @@ COPY app ./app # Copy git info metadata if generated on host COPY .git_api_info* /app/.git_api_info -# Install project and CLI scripts into PATH -RUN pip install --no-cache-dir -e . +# Install project and CLI scripts into system PATH using persistent BuildKit cache +RUN --mount=type=cache,target=/root/.cache/uv uv pip install --system -e . EXPOSE 8000 -- 2.34.1