From 4690d3a3072419abe7c19444857461039acfb3ac Mon Sep 17 00:00:00 2001 From: arabcoders Date: Sun, 31 Aug 2025 00:27:15 +0300 Subject: [PATCH] rebase on top of debian instead of alpine --- .vscode/settings.json | 2 ++ Dockerfile | 48 +++++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c80a6e10..032aea6b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -40,9 +40,11 @@ "defusedxml", "dlfields", "dotenv", + "dpkg", "edgechromium", "engineio", "Errno", + "esac", "euuo", "excepthook", "faststart", diff --git a/Dockerfile b/Dockerfile index 6c070c15..22e66f30 100644 --- a/Dockerfile +++ b/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-slim AS python_builder ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 @@ -13,18 +13,22 @@ 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 -# 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 WORKDIR /opt/ COPY ./pyproject.toml ./uv.lock ./ -RUN --mount=type=cache,target=/root/.cache/pip uv venv --system-site-packages --relocatable ./python && \ - VIRTUAL_ENV=/opt/python uv sync --link-mode=copy --active +RUN --mount=type=cache,target=/root/.cache/pip,id=pip-cache \ + --mount=type=cache,target=/root/.cache/uv,id=uv-cache \ + uv -vv venv --system-site-packages --relocatable ./python && \ + VIRTUAL_ENV=/opt/python uv -vv sync --link-mode=copy --active -FROM python:3.13-alpine +FROM python:3.13-slim ARG TZ=UTC ARG USER_ID=1000 @@ -41,9 +45,10 @@ ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONFAULTHANDLER=1 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,13 +57,34 @@ 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 --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 +# Install Jellyfin portable ffmpeg (per-arch) +ARG JELLYFIN_FFMPEG_VERSION=7.1.1-7 +RUN set -eux \ + && arch="$(dpkg --print-architecture)" \ + && case "$arch" in \ + amd64) jf_arch="linux64" ;; \ + arm64) jf_arch="linuxarm64" ;; \ + *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ + esac \ + && url="https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${JELLYFIN_FFMPEG_VERSION}/jellyfin-ffmpeg_${JELLYFIN_FFMPEG_VERSION}_portable_${jf_arch}-gpl.tar.xz" \ + && echo "Downloading $url" \ + && curl -fsSL "$url" -o /tmp/jf-ffmpeg.tar.xz + +RUN mkdir -p /tmp/jf-ffmpeg && tar -xJf /tmp/jf-ffmpeg.tar.xz -C /tmp/jf-ffmpeg \ + && ls -la /tmp/jf-ffmpeg \ + && install -m 0755 /tmp/jf-ffmpeg/ffmpeg /usr/bin/ffmpeg \ + && install -m 0755 /tmp/jf-ffmpeg/ffprobe /usr/bin/ffprobe \ + && /usr/bin/ffmpeg -version >/dev/null \ + && /usr/bin/ffprobe -version >/dev/null \ + && rm -rf /tmp/jf-ffmpeg.tar.xz /tmp/jf-ffmpeg + VOLUME /config VOLUME /downloads