From ec43b0290c9ba69d0dbaff30e09f8c7f98cd3fab Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sat, 30 Aug 2025 22:57:34 +0300 Subject: [PATCH 1/8] test new build system --- .github/workflows/build-pr.yml | 52 ++++++++++ .github/workflows/main.yml | 171 ++++++++++++++++----------------- .vscode/settings.json | 3 + 3 files changed, 139 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/build-pr.yml diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 00000000..086e442d --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,52 @@ +name: Build PR (docker amd64) + +on: + pull_request: + branches: + - master + paths-ignore: + - "**.md" + - ".github/ISSUE_TEMPLATE/**" + +env: + PNPM_VERSION: 10 + NODE_VERSION: 20 + +jobs: + build-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: pnpm + cache-dependency-path: "ui/pnpm-lock.yaml" + + - name: Install frontend dependencies & Build + working-directory: ui + run: | + pnpm install --production --prefer-offline --frozen-lockfile + pnpm run generate + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build commit to check (amd64 only) + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64 + push: false + cache-from: type=gha,scope=${{ github.workflow }} + cache-to: type=gha,mode=max,scope=${{ github.workflow }} + provenance: false + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 234c95b0..40c936f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,40 +1,22 @@ -name: build +name: Build Docker (native multi-arch) on: workflow_dispatch: inputs: - logLevel: - description: "Log level" - required: true - default: "warning" - type: choice - options: - - info - - warning - - debug build: - description: "Build" - required: false - default: false + description: "Build and publish native multi-arch image" type: boolean + default: true update_readme: - description: "Update Readme" - required: false - default: false + description: "Also sync DockerHub README" type: boolean - + default: false push: branches: - dev - master tags: - "v*" - paths-ignore: - - "**.md" - - ".github/**" - pull_request: - branches: - - "master" paths-ignore: - "**.md" - ".github/ISSUE_TEMPLATE/**" @@ -46,55 +28,21 @@ env: NODE_VERSION: 20 jobs: - build-pr: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: pnpm - cache-dependency-path: "ui/pnpm-lock.yaml" - - - name: Install frontend dependencies & Build - working-directory: ui - run: | - pnpm install --production --prefer-offline --frozen-lockfile - pnpm run generate - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build commit to check. - uses: docker/build-push-action@v5 - with: - context: . - platforms: linux/amd64 - push: false - cache-from: type=gha, scope=${{ github.workflow }} - cache-to: type=gha, mode=max, scope=${{ github.workflow }} - - push-build: - runs-on: ubuntu-latest - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.build == 'true') + docker-build-arch: + name: Build image (${{ matrix.arch }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + arch: amd64 + - os: ubuntu-24.04-arm64 + arch: arm64 permissions: packages: write contents: write env: - PLATFORMS: ${{ startsWith(github.ref, 'refs/tags/v') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} - + ARCH: ${{ matrix.arch }} steps: - name: Checkout uses: actions/checkout@v4 @@ -133,9 +81,7 @@ jobs: DATE=$(date -u +"%Y%m%d") BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/\//-/g') - echo "Current version: ${VERSION}, Branch: ${BRANCH}, SHA: ${SHA}, Date: ${DATE}" - - echo "APP_VERSION=${VERSION}" >> $"$GITHUB_ENV" + echo "APP_VERSION=${VERSION}" >> "$GITHUB_ENV" echo "APP_SHA=${SHA}" >> "$GITHUB_ENV" echo "APP_DATE=${DATE}" >> "$GITHUB_ENV" echo "APP_BRANCH=${BRANCH}" >> "$GITHUB_ENV" @@ -147,25 +93,20 @@ jobs: -e "s/^APP_BRANCH = \".*\"/APP_BRANCH = \"${BRANCH}\"/" \ app/library/version.py - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Docker meta + - name: Docker meta (arch-suffixed) id: meta uses: docker/metadata-action@v5 with: images: | ${{ env.DOCKERHUB_SLUG }} ${{ env.GHCR_SLUG }} - tags: | - type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} - type=ref,event=branch - type=ref,event=tag flavor: | latest=false + suffix=-${{ env.ARCH }} + tags: | + type=ref,event=branch + type=ref,event=tag + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -180,16 +121,71 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push (native per-arch) uses: docker/build-push-action@v5 with: context: . - platforms: ${{ env.PLATFORMS }} + platforms: linux/${{ env.ARCH }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha, scope=${{ github.workflow }} - cache-to: type=gha, mode=max, scope=${{ github.workflow }} + cache-from: | + type=gha,scope=${{ github.workflow }} + type=registry,ref=ghcr.io/arabcoders/ytptube:buildcache + cache-to: | + type=gha,mode=max,scope=${{ github.workflow }} + type=registry,ref=ghcr.io/arabcoders/ytptube:buildcache,mode=max + provenance: false + + docker-publish-manifest: + name: Publish multi-arch manifest + needs: [docker-build-arch] + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Docker meta (final tags) + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.DOCKERHUB_SLUG }} + ${{ env.GHCR_SLUG }} + flavor: | + latest=false + tags: | + type=ref,event=branch + type=ref,event=tag + type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Create and push manifest list + shell: bash + run: | + IFS=$'\n' + for tag in $(echo "${{ steps.meta.outputs.tags }}"); do + echo "Creating manifest for ${tag}" + docker buildx imagetools create \ + --tag "$tag" \ + "${tag}-amd64" \ + "${tag}-arm64" + done - name: Overwrite GitHub release notes if: startsWith(github.ref, 'refs/tags/v') @@ -213,7 +209,7 @@ jobs: const { data: comparison } = await github.rest.repos.compareCommits({ owner: context.repo.owner, repo: context.repo.repo, - base: latestRelease.data[1]?.tag_name || '', // fallback to second latest tag + base: latestRelease.data[1]?.tag_name || '', head: tag, }); @@ -238,6 +234,7 @@ jobs: }); dockerhub-sync-readme: + name: DockerHub README sync runs-on: ubuntu-latest permissions: contents: read diff --git a/.vscode/settings.json b/.vscode/settings.json index f700e9c5..c80a6e10 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,6 +25,7 @@ "bilibili", "brainicism", "brotlicffi", + "buildcache", "choco", "consoletitle", "continuedl", @@ -52,10 +53,12 @@ "fribidi", "getpid", "gibibytes", + "gitpython", "gpac", "hiddenimports", "hookspath", "httpx", + "imagetools", "kibibytes", "levelno", "libcurl", From fbaf8e5404ce7caf197cb41bda658be107627d6c Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sat, 30 Aug 2025 23:08:09 +0300 Subject: [PATCH 2/8] updates --- .github/workflows/build-pr.yml | 2 +- .github/workflows/main.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 086e442d..13190c13 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -1,4 +1,4 @@ -name: Build PR (docker amd64) +name: Test Build PR on: pull_request: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 40c936f7..626f3548 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build Docker (native multi-arch) +name: Build Docker Containers on: workflow_dispatch: @@ -29,14 +29,14 @@ env: jobs: docker-build-arch: - name: Build image (${{ matrix.arch }}) + name: Build Container (${{ matrix.arch }}) runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest arch: amd64 - - os: ubuntu-24.04-arm64 + - os: ubuntu-latest arch: arm64 permissions: packages: write @@ -93,7 +93,7 @@ jobs: -e "s/^APP_BRANCH = \".*\"/APP_BRANCH = \"${BRANCH}\"/" \ app/library/version.py - - name: Docker meta (arch-suffixed) + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: @@ -124,7 +124,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build and push (native per-arch) + - name: Build and push uses: docker/build-push-action@v5 with: context: . @@ -148,7 +148,7 @@ jobs: packages: write contents: read steps: - - name: Docker meta (final tags) + - name: Docker meta id: meta uses: docker/metadata-action@v5 with: From ae6c86d5d887b91e6f512f1e776bc3b0fe7b7bc3 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sat, 30 Aug 2025 23:25:16 +0300 Subject: [PATCH 3/8] Add permissions section to build PR workflow --- .github/workflows/build-pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 13190c13..a1ebe80e 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -1,5 +1,8 @@ name: Test Build PR +permissions: + contents: read + on: pull_request: branches: From 4690d3a3072419abe7c19444857461039acfb3ac Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sun, 31 Aug 2025 00:27:15 +0300 Subject: [PATCH 4/8] rebase on top of debian instead of alpine --- .vscode/settings.json | 2 ++ Dockerfile | 48 +++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c80a6e10..032aea6b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -40,9 +40,11 @@ "defusedxml", "dlfields", "dotenv", + "dpkg", "edgechromium", "engineio", "Errno", + "esac", "euuo", "excepthook", "faststart", diff --git a/Dockerfile b/Dockerfile index 6c070c15..22e66f30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app COPY ui ./ RUN if [ ! -f "/app/exported/index.html" ]; then npm install --production --prefer-offline --frozen-lockfile && npm run generate; else echo "Skipping UI build, already built."; fi -FROM python:3.13-alpine AS python_builder +FROM python:3.13-slim AS python_builder ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 @@ -13,18 +13,22 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONFAULTHANDLER=1 ENV PIP_NO_CACHE_DIR=off ENV PIP_CACHE_DIR=/root/.cache/pip -ENV UV_CACHE_DIR=/root/.cache/pip +ENV UV_CACHE_DIR=/root/.cache/uv -# Install dependencies -RUN apk add --update coreutils curl gcc g++ musl-dev libffi-dev openssl-dev curl make && pip install uv +# Install build dependencies and uv +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential libffi-dev libssl-dev curl ca-certificates pkg-config \ + && pip install --no-cache-dir uv WORKDIR /opt/ COPY ./pyproject.toml ./uv.lock ./ -RUN --mount=type=cache,target=/root/.cache/pip uv venv --system-site-packages --relocatable ./python && \ - VIRTUAL_ENV=/opt/python uv sync --link-mode=copy --active +RUN --mount=type=cache,target=/root/.cache/pip,id=pip-cache \ + --mount=type=cache,target=/root/.cache/uv,id=uv-cache \ + uv -vv venv --system-site-packages --relocatable ./python && \ + VIRTUAL_ENV=/opt/python uv -vv sync --link-mode=copy --active -FROM python:3.13-alpine +FROM python:3.13-slim ARG TZ=UTC ARG USER_ID=1000 @@ -41,9 +45,10 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONFAULTHANDLER=1 RUN mkdir /config /downloads && ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone && \ - apk add --update --no-cache bash mkvtoolnix patch aria2 coreutils curl shadow sqlite tzdata libmagic ffmpeg rtmpdump fribidi git && \ - useradd -u ${USER_ID:-1000} -U -d /app -s /bin/bash app && \ - rm -rf /var/cache/apk/* + apt-get update && apt-get install -y --no-install-recommends \ + bash mkvtoolnix patch aria2 curl ca-certificates xz-utils git sqlite3 tzdata file libmagic1 \ + && useradd -u ${USER_ID:-1000} -U -d /app -s /bin/bash app \ + && rm -rf /var/lib/apt/lists/* COPY entrypoint.sh / @@ -52,13 +57,34 @@ RUN sed -i 's/\r$//g' /entrypoint.sh && chmod +x /entrypoint.sh COPY --chown=app:app ./app /app/app COPY --chown=app:app --from=node_builder /app/exported /app/ui/exported COPY --chown=app:app --from=python_builder /opt/python /opt/python -COPY --chown=app:app --from=ghcr.io/arabcoders/alpine-mp4box /usr/bin/mp4box /usr/bin/mp4box +COPY --from=ghcr.io/arabcoders/alpine-mp4box /usr/bin/mp4box /usr/bin/mp4box COPY --chown=app:app ./healthcheck.sh /usr/local/bin/healthcheck ENV PATH="/opt/python/bin:$PATH" RUN chown -R app:app /config /downloads && chmod +x /usr/local/bin/healthcheck /usr/bin/mp4box +# Install Jellyfin portable ffmpeg (per-arch) +ARG JELLYFIN_FFMPEG_VERSION=7.1.1-7 +RUN set -eux \ + && arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) jf_arch="linux64" ;; \ + arm64) jf_arch="linuxarm64" ;; \ + *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ + esac \ + && url="https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${JELLYFIN_FFMPEG_VERSION}/jellyfin-ffmpeg_${JELLYFIN_FFMPEG_VERSION}_portable_${jf_arch}-gpl.tar.xz" \ + && echo "Downloading $url" \ + && curl -fsSL "$url" -o /tmp/jf-ffmpeg.tar.xz + +RUN mkdir -p /tmp/jf-ffmpeg && tar -xJf /tmp/jf-ffmpeg.tar.xz -C /tmp/jf-ffmpeg \ + && ls -la /tmp/jf-ffmpeg \ + && install -m 0755 /tmp/jf-ffmpeg/ffmpeg /usr/bin/ffmpeg \ + && install -m 0755 /tmp/jf-ffmpeg/ffprobe /usr/bin/ffprobe \ + && /usr/bin/ffmpeg -version >/dev/null \ + && /usr/bin/ffprobe -version >/dev/null \ + && rm -rf /tmp/jf-ffmpeg.tar.xz /tmp/jf-ffmpeg + VOLUME /config VOLUME /downloads From 1a2d5bc74e18fcf4a794d4edc3b0432d0b8c242e Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sun, 31 Aug 2025 01:17:12 +0300 Subject: [PATCH 5/8] rebase our docker containers on top of debian. --- Dockerfile | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 22e66f30..690d855d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,32 +58,14 @@ COPY --chown=app:app ./app /app/app COPY --chown=app:app --from=node_builder /app/exported /app/ui/exported COPY --chown=app:app --from=python_builder /opt/python /opt/python COPY --from=ghcr.io/arabcoders/alpine-mp4box /usr/bin/mp4box /usr/bin/mp4box +COPY --from=ghcr.io/arabcoders/jellyfin-ffmpeg /usr/bin/ffmpeg /usr/bin/ffmpeg +COPY --from=ghcr.io/arabcoders/jellyfin-ffmpeg /usr/bin/ffprobe /usr/bin/ffprobe COPY --chown=app:app ./healthcheck.sh /usr/local/bin/healthcheck ENV PATH="/opt/python/bin:$PATH" -RUN chown -R app:app /config /downloads && chmod +x /usr/local/bin/healthcheck /usr/bin/mp4box - -# Install Jellyfin portable ffmpeg (per-arch) -ARG JELLYFIN_FFMPEG_VERSION=7.1.1-7 -RUN set -eux \ - && arch="$(dpkg --print-architecture)" \ - && case "$arch" in \ - amd64) jf_arch="linux64" ;; \ - arm64) jf_arch="linuxarm64" ;; \ - *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ - esac \ - && url="https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${JELLYFIN_FFMPEG_VERSION}/jellyfin-ffmpeg_${JELLYFIN_FFMPEG_VERSION}_portable_${jf_arch}-gpl.tar.xz" \ - && echo "Downloading $url" \ - && curl -fsSL "$url" -o /tmp/jf-ffmpeg.tar.xz - -RUN mkdir -p /tmp/jf-ffmpeg && tar -xJf /tmp/jf-ffmpeg.tar.xz -C /tmp/jf-ffmpeg \ - && ls -la /tmp/jf-ffmpeg \ - && install -m 0755 /tmp/jf-ffmpeg/ffmpeg /usr/bin/ffmpeg \ - && install -m 0755 /tmp/jf-ffmpeg/ffprobe /usr/bin/ffprobe \ - && /usr/bin/ffmpeg -version >/dev/null \ - && /usr/bin/ffprobe -version >/dev/null \ - && rm -rf /tmp/jf-ffmpeg.tar.xz /tmp/jf-ffmpeg +RUN chown -R app:app /config /downloads && \ + chmod +x /usr/local/bin/healthcheck /usr/bin/mp4box /usr/bin/ffmpeg /usr/bin/ffprobe VOLUME /config VOLUME /downloads From e7614b8ebf66444ed7a288710d6560079fa2c729 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sun, 31 Aug 2025 01:21:45 +0300 Subject: [PATCH 6/8] add DEBIAN_FRONTEND --- .vscode/settings.json | 1 + Dockerfile | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 032aea6b..13a0ca2f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -85,6 +85,7 @@ "muxdelay", "mweb", "nodesc", + "noninteractive", "noprogress", "onefile", "pathex", diff --git a/Dockerfile b/Dockerfile index 690d855d..b87f56ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ ENV PYTHONFAULTHANDLER=1 ENV PIP_NO_CACHE_DIR=off ENV PIP_CACHE_DIR=/root/.cache/pip ENV UV_CACHE_DIR=/root/.cache/uv +ENV DEBIAN_FRONTEND=noninteractive # Install build dependencies and uv RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -44,6 +45,8 @@ ENV PYDEVD_DISABLE_FILE_VALIDATION=1 ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONFAULTHANDLER=1 +ARG DEBIAN_FRONTEND=noninteractive + RUN mkdir /config /downloads && ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone && \ apt-get update && apt-get install -y --no-install-recommends \ bash mkvtoolnix patch aria2 curl ca-certificates xz-utils git sqlite3 tzdata file libmagic1 \ From d84096c1c899aa5b390e2dc3d5cf52e9dde2c10e Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sun, 31 Aug 2025 01:31:08 +0300 Subject: [PATCH 7/8] lets see if uv able to get pre-built to speed up builds --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b87f56ff..c43afa2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,8 @@ ENV UV_CACHE_DIR=/root/.cache/uv ENV DEBIAN_FRONTEND=noninteractive # Install build dependencies and uv -RUN apt-get update && apt-get install -y --no-install-recommends \ - build-essential libffi-dev libssl-dev curl ca-certificates pkg-config \ - && pip install --no-cache-dir uv +# RUN apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libssl-dev curl ca-certificates pkg-config && pip install --no-cache-dir uv +RUN pip install --no-cache-dir uv WORKDIR /opt/ From acc6d54db22d7c679edbb0cc5e020f8d14e4ddd2 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sun, 31 Aug 2025 01:48:16 +0300 Subject: [PATCH 8/8] pip is so slow using arm64 during build --- Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index c43afa2d..a049b743 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ WORKDIR /app COPY ui ./ RUN if [ ! -f "/app/exported/index.html" ]; then npm install --production --prefer-offline --frozen-lockfile && npm run generate; else echo "Skipping UI build, already built."; fi -FROM python:3.13-slim AS python_builder +FROM python:3.13-bookworm AS python_builder ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 @@ -15,18 +15,19 @@ ENV PIP_NO_CACHE_DIR=off ENV PIP_CACHE_DIR=/root/.cache/pip ENV UV_CACHE_DIR=/root/.cache/uv ENV DEBIAN_FRONTEND=noninteractive +ENV UV_INSTALL_DIR=/usr/bin # Install build dependencies and uv # RUN apt-get update && apt-get install -y --no-install-recommends build-essential libffi-dev libssl-dev curl ca-certificates pkg-config && pip install --no-cache-dir uv -RUN pip install --no-cache-dir uv +RUN echo 1 && curl -LsSf https://astral.sh/uv/install.sh | sh WORKDIR /opt/ COPY ./pyproject.toml ./uv.lock ./ RUN --mount=type=cache,target=/root/.cache/pip,id=pip-cache \ --mount=type=cache,target=/root/.cache/uv,id=uv-cache \ - uv -vv venv --system-site-packages --relocatable ./python && \ - VIRTUAL_ENV=/opt/python uv -vv sync --link-mode=copy --active + uv venv --system-site-packages --relocatable ./python && \ + VIRTUAL_ENV=/opt/python uv sync --link-mode=copy --active FROM python:3.13-slim