diff --git a/dockerfile b/dockerfile index d1a5293..be95254 100644 --- a/dockerfile +++ b/dockerfile @@ -9,20 +9,19 @@ VOLUME ["/app/params", "/app/data", "/app/downloads", "/app/logs"] EXPOSE 80 COPY --chmod=755 entrypoint.sh ./ -COPY *.py pip_requirements_$TARGET_ARCH ./ +COPY *.py pip_requirements ./ COPY params/*.py params/*.ini params/userscript.js params/hooks_requirements ./setup/ COPY params/params_docker.ini ./setup/params.ini -RUN if [ "$TARGET_ARCH" = "arm" ] ; then apt update && apt install gcc python3-dev -y && apt-get autoremove && apt-get -y clean && rm -rf /var/lib/apt/lists/*; fi +RUN if [ "$TARGET_ARCH" = "arm" ] ; then apt update && apt install gcc python3-dev -y; fi +RUN apt update && apt install wget xz-utils -y && apt-get autoremove && apt-get -y clean && rm -rf /var/lib/apt/lists/* -RUN apt update && apt install wget xz-utils -y - -RUN ARCH=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \ -wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-${ARCH}-static.tar.xz -O /ffmpeg.tar.xz && \ +RUN ARCH=$(arch | sed s/aarch64/linuxarm64/ | sed s/x86_64/linux64/) && \ +wget https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-${ARCH}-gpl.tar.xz -O /ffmpeg.tar.xz && \ tar -xf /ffmpeg.tar.xz -C /tmp && \ -install --mode=777 /tmp/ffmpeg-*-static/ffmpeg /usr/bin && \ -install --mode=777 /tmp/ffmpeg-*-static/ffprobe /usr/bin && \ -rm /ffmpeg.tar.xz /tmp/ffmpeg-*-static -rf && \ -pip3 install --disable-pip-version-check -q --root-user-action=ignore -r pip_requirements_$TARGET_ARCH +install --mode=777 /tmp/ffmpeg-*/bin/ffmpeg /usr/bin && \ +install --mode=777 /tmp/ffmpeg-*/bin/ffprobe /usr/bin && \ +rm /ffmpeg.tar.xz /tmp/ffmpeg-* -rf && \ +pip3 install --disable-pip-version-check -q --root-user-action=ignore -r pip_requirements ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 6976f5c..4e1ed1f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,17 +7,13 @@ echo ~~~ Docker image generated : $DATE mkdir -p /app/logs /app/downloads /app/params /app/tmp /app/data /root/yt-dlp-plugins /app/cookies/ /home/ydl_api_ng getent group $GID >/dev/null -if [ $? -eq 0 ]; then - groupmod $(id --name --group $GID) -n ydl_api_ng -else +if [ ! $? -eq 0 ]; then addgroup --gid $GID ydl_api_ng fi getent passwd $UID >/dev/null -if [ $? -eq 0 ]; then - usermod $(id --name --user $UID) -l ydl_api_ng -else - useradd --uid $UID --gid ydl_api_ng ydl_api_ng +if [ ! $? -eq 0 ]; then + useradd --uid $UID --gid $GID ydl_api_ng -b /home/ydl_api_ng fi # If params.ini exists, assume setup has been run. Don't copy extra files the user may have removed. @@ -58,7 +54,7 @@ fi if [ "$DEBUG" == "DEBUG" ]; then echo ~~~ Launching DEBUG mode ~~~ - su ydl_api_ng -c "uvicorn main:app --reload --port 80 --host 0.0.0.0" + su "$(id -un $UID)" -c "uvicorn main:app --reload --port 80 --host 0.0.0.0" else - su ydl_api_ng -c "python3 main.py" + su "$(id -un $UID)" -c "python3 main.py" fi diff --git a/params/workers.ini b/params/workers.ini index 07e3342..b47180c 100644 --- a/params/workers.ini +++ b/params/workers.ini @@ -2,7 +2,7 @@ logfile=/app/logs/supervisord.log pidfile=/app/tmp/supervisord_pid loglevel=%(ENV_LOG_LEVEL)s -user= ydl_api_ng +user=%(ENV_UID)s ; You can remove this block if you don't plan to use the programmation function [program:programmation] diff --git a/pip_requirements_amd b/pip_requirements similarity index 100% rename from pip_requirements_amd rename to pip_requirements diff --git a/pip_requirements_arm b/pip_requirements_arm deleted file mode 100644 index c6c64ba..0000000 --- a/pip_requirements_arm +++ /dev/null @@ -1,13 +0,0 @@ -cronsim -fastapi -ffmpeg-python -humanize -mergedeep -psutil -redis -requests -rq -supervisor -tinydb -uvicorn -yt-dlp \ No newline at end of file