From cc05d7fccf31b2cec43389a0154834ab1428380a Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 25 May 2025 01:39:43 -0400 Subject: [PATCH 1/3] Add `uv` stages --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index c878890e..7d9d43a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,6 +58,8 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va apt-get -y autoclean && \ rm -f /var/cache/debconf/*.dat-old +FROM ghcr.io/astral-sh/uv:latest AS uv-binaries + FROM alpine:${ALPINE_VERSION} AS openresty-debian ARG TARGETARCH ARG DEBIAN_VERSION @@ -279,6 +281,9 @@ RUN set -eu ; \ FROM scratch AS s6-overlay COPY --from=s6-overlay-extracted /s6-overlay-rootfs / +FROM tubesync-base AS tubesync-uv +COPY --from=uv-binaries /uv /uvx /usr/local/bin/ + FROM tubesync-base AS tubesync-openresty COPY --from=openresty-debian \ From de9ee5e717c075dda8c57bf516d2eeee17362137 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 25 May 2025 01:44:03 -0400 Subject: [PATCH 2/3] Bind mount `uv` into `PATH` --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 7d9d43a6..d983bac6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -391,6 +391,7 @@ RUN --mount=type=tmpfs,target=/cache \ --mount=type=cache,id=pipenv-cache,sharing=locked,target=/cache/pipenv \ --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \ --mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \ + --mount=type=bind,source=/uv,target=/usr/local/bin/uv,from=uv-binaries \ --mount=type=bind,source=Pipfile,target=/app/Pipfile \ set -x && \ apt-get update && \ From b84fbb77dfbcd8b085a2fef13589889ce5234671 Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 25 May 2025 01:54:06 -0400 Subject: [PATCH 3/3] Install and run `pipenv` using `uv` --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d983bac6..96aade0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -340,12 +340,10 @@ RUN --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/va libmariadb3 \ libpq5 \ libwebp7 \ - pipenv \ pkgconf \ python3 \ python3-libsass \ python3-socks \ - python3-wheel \ curl \ less \ && \ @@ -388,6 +386,7 @@ ARG YTDLP_DATE # Set up the app RUN --mount=type=tmpfs,target=/cache \ + --mount=type=cache,id=uv-cache,sharing=locked,target=/cache/uv \ --mount=type=cache,id=pipenv-cache,sharing=locked,target=/cache/pipenv \ --mount=type=cache,id=apt-lib-cache-${TARGETARCH},sharing=private,target=/var/lib/apt \ --mount=type=cache,id=apt-cache-cache,sharing=private,target=/var/cache/apt \ @@ -406,7 +405,6 @@ RUN --mount=type=tmpfs,target=/cache \ make \ postgresql-common \ python3-dev \ - python3-pip \ zlib1g-dev \ && \ # Install non-distro packages @@ -415,6 +413,7 @@ RUN --mount=type=tmpfs,target=/cache \ XDG_CACHE_HOME='/cache' \ PIPENV_VERBOSITY=64 \ PYTHONPYCACHEPREFIX=/cache/pycache \ + uv tool run --no-config --no-progress --no-managed-python -- \ pipenv install --system --skip-lock && \ # remove the getpot_bgutil_script plugin find /usr/local/lib \ @@ -433,7 +432,6 @@ RUN --mount=type=tmpfs,target=/cache \ make \ postgresql-common \ python3-dev \ - python3-pip \ zlib1g-dev \ && \ apt-get -y autopurge && \