Run the token web server with deno
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -1,6 +1,7 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
# check=error=true
|
# check=error=true
|
||||||
|
|
||||||
|
ARG BGUTIL_YTDLP_POT_PROVIDER_VERSION="1.2.2"
|
||||||
ARG FFMPEG_VERSION="N"
|
ARG FFMPEG_VERSION="N"
|
||||||
|
|
||||||
ARG ASFALD_VERSION="0.6.0"
|
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 && \
|
rm -v /app/tubesync/local_settings.py.example && \
|
||||||
mv -v /app/tubesync/local_settings.py.container /app/tubesync/local_settings.py
|
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
|
FROM scratch AS tubesync-app
|
||||||
COPY --from=tubesync-prepare-app /app /app
|
COPY --from=tubesync-prepare-app /app /app
|
||||||
|
|
||||||
@@ -649,6 +658,18 @@ COPY patches/yt_dlp/ \
|
|||||||
# Copy app
|
# Copy app
|
||||||
COPY --from=tubesync-app /app /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
|
# Build app
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
# Record the bundled deno version when it was included
|
# Record the bundled deno version when it was included
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
upstream token_server {
|
upstream token_server {
|
||||||
server 127.0.0.2:4416 down;
|
server 127.0.0.1:4406 max_fails=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
base
|
||||||
|
tubesync-init
|
||||||
28
config/root/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider-build/run
Executable file
28
config/root/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider-build/run
Executable 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 .
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
3
config/root/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider-build/up
Executable file
3
config/root/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider-build/up
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/command/execlineb -P
|
||||||
|
|
||||||
|
/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider-build/run
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
base
|
||||||
|
bgutil-ytdlp-pot-provider-build
|
||||||
7
config/root/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider/run
Executable file
7
config/root/etc/s6-overlay/s6-rc.d/bgutil-ytdlp-pot-provider/run
Executable 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
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
longrun
|
||||||
@@ -1 +1,2 @@
|
|||||||
|
base
|
||||||
tubesync-init
|
tubesync-init
|
||||||
0
config/root/etc/s6-overlay/s6-rc.d/huey-database/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-database/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-filesystem/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-filesystem/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-net-limited/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-net-limited/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-network/run
Normal file → Executable file
0
config/root/etc/s6-overlay/s6-rc.d/huey-network/run
Normal file → Executable file
@@ -1 +1,2 @@
|
|||||||
|
base
|
||||||
gunicorn
|
gunicorn
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
base
|
||||||
14
tubesync/bgutil-ytdlp-pot-provider/node
Executable file
14
tubesync/bgutil-ytdlp-pot-provider/node
Executable 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}" \
|
||||||
|
"$@"
|
||||||
Reference in New Issue
Block a user