Add Swoole alternative backend

This commit is contained in:
Jonathan Sykes
2026-10-14 00:43:38 +08:00
parent f465cc86d0
commit 1130fabc94
11 changed files with 756 additions and 0 deletions

27
alt/swoole/Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
# Build from repository root: docker build -f alt/swoole/Dockerfile .
FROM php:8.3-cli-bookworm
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/install-php-extensions
RUN chmod +x /usr/local/bin/install-php-extensions \
&& apt-get update -qq \
&& apt-get install -y --no-install-recommends ca-certificates curl ffmpeg brotli python3 \
&& rm -rf /var/lib/apt/lists/* \
&& install-php-extensions swoole-5.1.7 pdo_sqlite mbstring
# yt-dlp needs a JS runtime for current YouTube challenge extraction.
RUN curl -fsSL https://deno.land/install.sh | sh -s -- -y \
&& ln -s /root/.deno/bin/deno /usr/local/bin/deno \
&& curl -fsSL https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
&& chmod +x /usr/local/bin/yt-dlp \
&& printf -- '--js-runtimes deno:/usr/local/bin/deno\n' > /etc/yt-dlp.conf
WORKDIR /app
COPY frontend/ /app/public/
COPY alt/swoole/ /app/alt/swoole/
RUN mkdir -p /app/data/media /app/data \
&& date -u +"%Y-%m-%dT%H:%M:%SZ" > /app/build-time.txt
ENV PORT=3000 DB_PATH=/app/data/ytplayer.sqlite MEDIA_DIR=/app/data/media PUBLIC_DIR=/app/public
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD curl -fsS http://127.0.0.1:3000/api/version || exit 1
CMD ["php", "/app/alt/swoole/server.php"]