add BgUtils POT Provider (closes #886)

This commit is contained in:
Alex Shnitman
2026-02-03 23:02:00 +02:00
parent c28cedacb7
commit 9df7776c79
3 changed files with 54 additions and 9 deletions

View File

@@ -3,10 +3,28 @@ FROM node:lts-alpine AS builder
WORKDIR /metube
COPY ui ./
RUN corepack enable && corepack prepare pnpm --activate
RUN pnpm install && pnpm run build
RUN CI=true pnpm install && pnpm run build
FROM python:3.13-alpine
FROM rust:1.93-slim AS bgutil-builder
WORKDIR /src
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
build-essential \
pkg-config \
libssl-dev \
python3 && \
BGUTIL_TAG="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases/latest | sed 's#.*/tag/##')" && \
curl -L "https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/archive/refs/tags/${BGUTIL_TAG}.tar.gz" \
| tar -xz --strip-components=1 && \
cargo build --release
FROM python:3.13-slim
WORKDIR /app
@@ -16,13 +34,36 @@ COPY pyproject.toml uv.lock docker-entrypoint.sh ./
# Install dependencies
RUN sed -i 's/\r$//g' docker-entrypoint.sh && \
chmod +x docker-entrypoint.sh && \
apk add --update ffmpeg aria2 coreutils shadow su-exec curl tini deno gdbm-tools sqlite file && \
apk add --update --virtual .build-deps gcc g++ musl-dev uv && \
apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
ffmpeg \
unzip \
aria2 \
coreutils \
gosu \
curl \
tini \
file \
gdbmtool \
sqlite3 \
build-essential && \
curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh && \
UV_PROJECT_ENVIRONMENT=/usr/local uv sync --frozen --no-dev --compile-bytecode && \
apk del .build-deps && \
rm -rf /var/cache/apk/* && \
curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh -s -- -y && \
apt-get purge -y --auto-remove build-essential && \
rm -rf /var/lib/apt/lists/* && \
mkdir /.cache && chmod 777 /.cache
COPY --from=bgutil-builder /src/target/release/bgutil-pot /usr/local/bin/bgutil-pot
RUN BGUTIL_TAG="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases/latest | sed 's#.*/tag/##')" && \
PLUGIN_DIR="$(python3 -c 'import site; print(site.getsitepackages()[0])')" && \
curl -L -o /tmp/bgutil-ytdlp-pot-provider-rs.zip \
"https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases/download/${BGUTIL_TAG}/bgutil-ytdlp-pot-provider-rs.zip" && \
unzip -q /tmp/bgutil-ytdlp-pot-provider-rs.zip -d "${PLUGIN_DIR}" && \
rm /tmp/bgutil-ytdlp-pot-provider-rs.zip
COPY app ./app
COPY --from=builder /metube/dist/metube ./ui/dist/metube
@@ -40,4 +81,4 @@ EXPOSE 8081
ARG VERSION=dev
ENV METUBE_VERSION=$VERSION
ENTRYPOINT ["/sbin/tini", "-g", "--", "./docker-entrypoint.sh"]
ENTRYPOINT ["/usr/bin/tini", "-g", "--", "./docker-entrypoint.sh"]

View File

@@ -13,9 +13,13 @@ if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
echo "Changing ownership of download and state directories to ${UID}:${GID}"
chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
fi
echo "Starting BgUtils POT Provider"
gosu "${UID}":"${GID}" bgutil-pot server >/tmp/bgutil-pot.log 2>&1 &
echo "Running MeTube as user ${UID}:${GID}"
exec su-exec "${UID}":"${GID}" python3 app/main.py
exec gosu "${UID}":"${GID}" python3 app/main.py
else
echo "User set by docker; running MeTube as `id -u`:`id -g`"
echo "Starting BgUtils POT Provider"
bgutil-pot server >/tmp/bgutil-pot.log 2>&1 &
exec python3 app/main.py
fi

View File

@@ -6,7 +6,7 @@ requires-python = ">=3.13"
dependencies = [
"aiohttp",
"python-socketio>=5.0,<6.0",
"yt-dlp[default,curl-cffi]",
"yt-dlp[default,curl-cffi,deno]",
"mutagen",
"curl-cffi",
"watchfiles",