Merge pull request #399 from arabcoders/dev
Some checks failed
Build Native wrappers / build (amd64, ubuntu-latest) (push) Has been cancelled
Build Native wrappers / build (amd64, windows-latest) (push) Has been cancelled
Build Native wrappers / build (arm64, macos-latest) (push) Has been cancelled
Build Native wrappers / build (arm64, ubuntu-latest) (push) Has been cancelled
Build Native wrappers / build (arm64, windows-latest) (push) Has been cancelled

test new build system
This commit is contained in:
Abdulmohsen 2025-08-31 01:52:57 +03:00 committed by GitHub
commit 7185bae58d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 165 additions and 96 deletions

55
.github/workflows/build-pr.yml vendored Normal file
View file

@ -0,0 +1,55 @@
name: Test Build PR
permissions:
contents: read
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

View file

@ -1,40 +1,22 @@
name: build name: Build Docker Containers
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
logLevel:
description: "Log level"
required: true
default: "warning"
type: choice
options:
- info
- warning
- debug
build: build:
description: "Build" description: "Build and publish native multi-arch image"
required: false
default: false
type: boolean type: boolean
default: true
update_readme: update_readme:
description: "Update Readme" description: "Also sync DockerHub README"
required: false
default: false
type: boolean type: boolean
default: false
push: push:
branches: branches:
- dev - dev
- master - master
tags: tags:
- "v*" - "v*"
paths-ignore:
- "**.md"
- ".github/**"
pull_request:
branches:
- "master"
paths-ignore: paths-ignore:
- "**.md" - "**.md"
- ".github/ISSUE_TEMPLATE/**" - ".github/ISSUE_TEMPLATE/**"
@ -46,55 +28,21 @@ env:
NODE_VERSION: 20 NODE_VERSION: 20
jobs: jobs:
build-pr: docker-build-arch:
runs-on: ubuntu-latest name: Build Container (${{ matrix.arch }})
if: github.event_name == 'pull_request' runs-on: ${{ matrix.os }}
steps: strategy:
- name: Checkout matrix:
uses: actions/checkout@v4 include:
- os: ubuntu-latest
- name: Install pnpm arch: amd64
uses: pnpm/action-setup@v4 - os: ubuntu-latest
with: arch: arm64
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')
permissions: permissions:
packages: write packages: write
contents: write contents: write
env: env:
PLATFORMS: ${{ startsWith(github.ref, 'refs/tags/v') && 'linux/amd64,linux/arm64' || 'linux/amd64' }} ARCH: ${{ matrix.arch }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -133,9 +81,7 @@ jobs:
DATE=$(date -u +"%Y%m%d") DATE=$(date -u +"%Y%m%d")
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/\//-/g') 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_SHA=${SHA}" >> "$GITHUB_ENV"
echo "APP_DATE=${DATE}" >> "$GITHUB_ENV" echo "APP_DATE=${DATE}" >> "$GITHUB_ENV"
echo "APP_BRANCH=${BRANCH}" >> "$GITHUB_ENV" echo "APP_BRANCH=${BRANCH}" >> "$GITHUB_ENV"
@ -147,12 +93,6 @@ jobs:
-e "s/^APP_BRANCH = \".*\"/APP_BRANCH = \"${BRANCH}\"/" \ -e "s/^APP_BRANCH = \".*\"/APP_BRANCH = \"${BRANCH}\"/" \
app/library/version.py 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
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
@ -160,12 +100,13 @@ jobs:
images: | images: |
${{ env.DOCKERHUB_SLUG }} ${{ env.DOCKERHUB_SLUG }}
${{ env.GHCR_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: | flavor: |
latest=false 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 - name: Login to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
@ -180,16 +121,71 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
platforms: ${{ env.PLATFORMS }} platforms: linux/${{ env.ARCH }}
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha, scope=${{ github.workflow }} cache-from: |
cache-to: type=gha, mode=max, scope=${{ github.workflow }} 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
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 - name: Overwrite GitHub release notes
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
@ -213,7 +209,7 @@ jobs:
const { data: comparison } = await github.rest.repos.compareCommits({ const { data: comparison } = await github.rest.repos.compareCommits({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
base: latestRelease.data[1]?.tag_name || '', // fallback to second latest tag base: latestRelease.data[1]?.tag_name || '',
head: tag, head: tag,
}); });
@ -238,6 +234,7 @@ jobs:
}); });
dockerhub-sync-readme: dockerhub-sync-readme:
name: DockerHub README sync
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read

View file

@ -25,6 +25,7 @@
"bilibili", "bilibili",
"brainicism", "brainicism",
"brotlicffi", "brotlicffi",
"buildcache",
"choco", "choco",
"consoletitle", "consoletitle",
"continuedl", "continuedl",
@ -39,9 +40,11 @@
"defusedxml", "defusedxml",
"dlfields", "dlfields",
"dotenv", "dotenv",
"dpkg",
"edgechromium", "edgechromium",
"engineio", "engineio",
"Errno", "Errno",
"esac",
"euuo", "euuo",
"excepthook", "excepthook",
"faststart", "faststart",
@ -52,10 +55,12 @@
"fribidi", "fribidi",
"getpid", "getpid",
"gibibytes", "gibibytes",
"gitpython",
"gpac", "gpac",
"hiddenimports", "hiddenimports",
"hookspath", "hookspath",
"httpx", "httpx",
"imagetools",
"kibibytes", "kibibytes",
"levelno", "levelno",
"libcurl", "libcurl",
@ -80,6 +85,7 @@
"muxdelay", "muxdelay",
"mweb", "mweb",
"nodesc", "nodesc",
"noninteractive",
"noprogress", "noprogress",
"onefile", "onefile",
"pathex", "pathex",

View file

@ -5,7 +5,7 @@ WORKDIR /app
COPY ui ./ 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 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-bookworm AS python_builder
ENV LANG=C.UTF-8 ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8 ENV LC_ALL=C.UTF-8
@ -13,18 +13,23 @@ ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1 ENV PYTHONFAULTHANDLER=1
ENV PIP_NO_CACHE_DIR=off ENV PIP_NO_CACHE_DIR=off
ENV PIP_CACHE_DIR=/root/.cache/pip ENV PIP_CACHE_DIR=/root/.cache/pip
ENV UV_CACHE_DIR=/root/.cache/pip ENV UV_CACHE_DIR=/root/.cache/uv
ENV DEBIAN_FRONTEND=noninteractive
ENV UV_INSTALL_DIR=/usr/bin
# Install dependencies # Install build dependencies and uv
RUN apk add --update coreutils curl gcc g++ musl-dev libffi-dev openssl-dev curl make && pip install 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 echo 1 && curl -LsSf https://astral.sh/uv/install.sh | sh
WORKDIR /opt/ WORKDIR /opt/
COPY ./pyproject.toml ./uv.lock ./ COPY ./pyproject.toml ./uv.lock ./
RUN --mount=type=cache,target=/root/.cache/pip uv venv --system-site-packages --relocatable ./python && \ RUN --mount=type=cache,target=/root/.cache/pip,id=pip-cache \
--mount=type=cache,target=/root/.cache/uv,id=uv-cache \
uv venv --system-site-packages --relocatable ./python && \
VIRTUAL_ENV=/opt/python uv sync --link-mode=copy --active VIRTUAL_ENV=/opt/python uv sync --link-mode=copy --active
FROM python:3.13-alpine FROM python:3.13-slim
ARG TZ=UTC ARG TZ=UTC
ARG USER_ID=1000 ARG USER_ID=1000
@ -40,10 +45,13 @@ ENV PYDEVD_DISABLE_FILE_VALIDATION=1
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1 ENV PYTHONFAULTHANDLER=1
ARG DEBIAN_FRONTEND=noninteractive
RUN mkdir /config /downloads && ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone && \ 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 && \ apt-get update && apt-get install -y --no-install-recommends \
useradd -u ${USER_ID:-1000} -U -d /app -s /bin/bash app && \ bash mkvtoolnix patch aria2 curl ca-certificates xz-utils git sqlite3 tzdata file libmagic1 \
rm -rf /var/cache/apk/* && useradd -u ${USER_ID:-1000} -U -d /app -s /bin/bash app \
&& rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh / COPY entrypoint.sh /
@ -52,12 +60,15 @@ RUN sed -i 's/\r$//g' /entrypoint.sh && chmod +x /entrypoint.sh
COPY --chown=app:app ./app /app/app COPY --chown=app:app ./app /app/app
COPY --chown=app:app --from=node_builder /app/exported /app/ui/exported 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=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 --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 COPY --chown=app:app ./healthcheck.sh /usr/local/bin/healthcheck
ENV PATH="/opt/python/bin:$PATH" ENV PATH="/opt/python/bin:$PATH"
RUN chown -R app:app /config /downloads && chmod +x /usr/local/bin/healthcheck /usr/bin/mp4box 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 /config
VOLUME /downloads VOLUME /downloads