Run the token web server with deno

This commit is contained in:
tcely
2025-12-27 05:59:51 -05:00
committed by GitHub
parent d70a749278
commit faa5464075
18 changed files with 85 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
# syntax=docker/dockerfile:1
# check=error=true
ARG BGUTIL_YTDLP_POT_PROVIDER_VERSION="1.2.2"
ARG FFMPEG_VERSION="N"
ARG ASFALD_VERSION="0.6.0"
@@ -414,6 +415,14 @@ RUN --mount=type=bind,source=fontawesome-free,target=/fontawesome-free \
rm -v /app/tubesync/local_settings.py.example && \
mv -v /app/tubesync/local_settings.py.container /app/tubesync/local_settings.py
ARG BGUTIL_YTDLP_POT_PROVIDER_VERSION
ADD "https://github.com/Brainicism/bgutil-ytdlp-pot-provider/archive/refs/tags/${BGUTIL_YTDLP_POT_PROVIDER_VERSION}.tar.gz" /tmp/
RUN mkdir -v /tmp/extracted && \
tar -C /tmp/extracted/ -xvvpf "/tmp/${BGUTIL_YTDLP_POT_PROVIDER_VERSION}.tar.gz" && \
mv -v /tmp/extracted/*/server /app/bgutil-ytdlp-pot-provider/ && \
ls -alR /app/bgutil-ytdlp-pot-provider && \
rm -rf /tmp/extracted
FROM scratch AS tubesync-app
COPY --from=tubesync-prepare-app /app /app
@@ -649,6 +658,18 @@ COPY patches/yt_dlp/ \
# Copy app
COPY --from=tubesync-app /app /app
# Build the bgutil-ytdlp-pot-provider server when deno is bundled
RUN --mount=type=tmpfs,target=/cache \
--mount=type=cache,id=deno-cache,sharing=locked,target=/cache/deno \
command -v deno || exit 0 ; \
set -x && \
DENO_DIR=/cache/deno && export DENO_DIR && \
cd /app/bgutil-ytdlp-pot-provider/server && \
install -v -t /usr/local/bin ../node && \
DENO_COMPAT=1 deno run -A npm:npm ci --no-fund && \
DENO_COMPAT=1 deno run -A npm:npm audit fix && \
node typescript:/tsc
# Build app
RUN set -x && \
# Record the bundled deno version when it was included

View File

@@ -1,5 +1,5 @@
upstream token_server {
server 127.0.0.2:4416 down;
server 127.0.0.1:4406 max_fails=0;
}
server {

View File

@@ -0,0 +1,2 @@
base
tubesync-init

View File

@@ -0,0 +1,28 @@
#!/command/with-contenv bash
set -eu
cd /app/bgutil-ytdlp-pot-provider/server
command -v deno >/dev/null || \
/app/install_deno.sh
test '!' -d build || \
test '!' -f build/main.js || \
test '!' -d node_modules || \
exit 0 # nothing needs to be built
command -v node > /dev/null || \
install -v -t /usr/local/bin ../node
chown -R app:app .
s6-setuidgid app \
env DENO_COMPAT=1 deno run -A npm:npm ci --no-fund
s6-setuidgid app \
env DENO_COMPAT=1 deno run -A npm:npm audit fix
s6-setuidgid app \
../node typescript:/tsc
chown -R root:app .

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1,3 @@
#!/command/execlineb -P
/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider-build/run

View File

@@ -0,0 +1,2 @@
base
bgutil-ytdlp-pot-provider-build

View File

@@ -0,0 +1,7 @@
#!/command/with-contenv bash
set -e
cd /app/bgutil-ytdlp-pot-provider
exec s6-setuidgid app \
./node server/build/main.js -p 4406

View File

@@ -0,0 +1 @@
longrun

View File

@@ -1 +1,2 @@
base
tubesync-init

0
config/root/etc/s6-overlay/s6-rc.d/huey-database/run Normal file → Executable file
View File

0
config/root/etc/s6-overlay/s6-rc.d/huey-filesystem/run Normal file → Executable file
View File

View File

0
config/root/etc/s6-overlay/s6-rc.d/huey-network/run Normal file → Executable file
View File

View File

@@ -1 +1,2 @@
base
gunicorn

View File

@@ -0,0 +1 @@
base

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env sh
command -v deno >/dev/null || \
sleep 24h
case "${1}%${#}" in
(--version%1) printf -- '%s\n' 'v24.12.0' ; exit ;;
esac
DENO_COMPAT=1 exec deno run --allow-env --allow-net --allow-sys \
--allow-ffi="${HOME}" \
--allow-read=. --allow-read="${HOME}" --allow-read="${XDG_CACHE_HOME}" \
--allow-write=. --allow-write="${HOME}" --allow-write="${XDG_CACHE_HOME}" \
"$@"