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
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:
commit
7185bae58d
4 changed files with 165 additions and 96 deletions
55
.github/workflows/build-pr.yml
vendored
Normal file
55
.github/workflows/build-pr.yml
vendored
Normal 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
|
||||
|
||||
167
.github/workflows/main.yml
vendored
167
.github/workflows/main.yml
vendored
|
|
@ -1,40 +1,22 @@
|
|||
name: build
|
||||
name: Build Docker Containers
|
||||
|
||||
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 Container (${{ matrix.arch }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
arch: amd64
|
||||
- os: ubuntu-latest
|
||||
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,12 +93,6 @@ 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
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
|
|
@ -160,12 +100,13 @@ jobs:
|
|||
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: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
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
|
||||
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
|
||||
|
|
|
|||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
|
|
@ -25,6 +25,7 @@
|
|||
"bilibili",
|
||||
"brainicism",
|
||||
"brotlicffi",
|
||||
"buildcache",
|
||||
"choco",
|
||||
"consoletitle",
|
||||
"continuedl",
|
||||
|
|
@ -39,9 +40,11 @@
|
|||
"defusedxml",
|
||||
"dlfields",
|
||||
"dotenv",
|
||||
"dpkg",
|
||||
"edgechromium",
|
||||
"engineio",
|
||||
"Errno",
|
||||
"esac",
|
||||
"euuo",
|
||||
"excepthook",
|
||||
"faststart",
|
||||
|
|
@ -52,10 +55,12 @@
|
|||
"fribidi",
|
||||
"getpid",
|
||||
"gibibytes",
|
||||
"gitpython",
|
||||
"gpac",
|
||||
"hiddenimports",
|
||||
"hookspath",
|
||||
"httpx",
|
||||
"imagetools",
|
||||
"kibibytes",
|
||||
"levelno",
|
||||
"libcurl",
|
||||
|
|
@ -80,6 +85,7 @@
|
|||
"muxdelay",
|
||||
"mweb",
|
||||
"nodesc",
|
||||
"noninteractive",
|
||||
"noprogress",
|
||||
"onefile",
|
||||
"pathex",
|
||||
|
|
|
|||
33
Dockerfile
33
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-bookworm AS python_builder
|
||||
|
||||
ENV LANG=C.UTF-8
|
||||
ENV LC_ALL=C.UTF-8
|
||||
|
|
@ -13,18 +13,23 @@ 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
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV UV_INSTALL_DIR=/usr/bin
|
||||
|
||||
# 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
|
||||
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 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
|
||||
|
||||
FROM python:3.13-alpine
|
||||
FROM python:3.13-slim
|
||||
|
||||
ARG TZ=UTC
|
||||
ARG USER_ID=1000
|
||||
|
|
@ -40,10 +45,13 @@ 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 && \
|
||||
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,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 --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 --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
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue