Improvment of UID management
This commit is contained in:
parent
6aab025321
commit
bb5e08e850
19
dockerfile
19
dockerfile
|
|
@ -9,20 +9,19 @@ VOLUME ["/app/params", "/app/data", "/app/downloads", "/app/logs"]
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
COPY --chmod=755 entrypoint.sh ./
|
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/*.py params/*.ini params/userscript.js params/hooks_requirements ./setup/
|
||||||
COPY params/params_docker.ini ./setup/params.ini
|
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/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 && \
|
||||||
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 && \
|
|
||||||
tar -xf /ffmpeg.tar.xz -C /tmp && \
|
tar -xf /ffmpeg.tar.xz -C /tmp && \
|
||||||
install --mode=777 /tmp/ffmpeg-*-static/ffmpeg /usr/bin && \
|
install --mode=777 /tmp/ffmpeg-*/bin/ffmpeg /usr/bin && \
|
||||||
install --mode=777 /tmp/ffmpeg-*-static/ffprobe /usr/bin && \
|
install --mode=777 /tmp/ffmpeg-*/bin/ffprobe /usr/bin && \
|
||||||
rm /ffmpeg.tar.xz /tmp/ffmpeg-*-static -rf && \
|
rm /ffmpeg.tar.xz /tmp/ffmpeg-* -rf && \
|
||||||
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r pip_requirements_$TARGET_ARCH
|
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r pip_requirements
|
||||||
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/app/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
|
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
|
getent group $GID >/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
groupmod $(id --name --group $GID) -n ydl_api_ng
|
|
||||||
else
|
|
||||||
addgroup --gid $GID ydl_api_ng
|
addgroup --gid $GID ydl_api_ng
|
||||||
fi
|
fi
|
||||||
|
|
||||||
getent passwd $UID >/dev/null
|
getent passwd $UID >/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
usermod $(id --name --user $UID) -l ydl_api_ng
|
useradd --uid $UID --gid $GID ydl_api_ng -b /home/ydl_api_ng
|
||||||
else
|
|
||||||
useradd --uid $UID --gid ydl_api_ng ydl_api_ng
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If params.ini exists, assume setup has been run. Don't copy extra files the user may have removed.
|
# 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
|
if [ "$DEBUG" == "DEBUG" ]; then
|
||||||
echo ~~~ Launching DEBUG mode ~~~
|
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
|
else
|
||||||
su ydl_api_ng -c "python3 main.py"
|
su "$(id -un $UID)" -c "python3 main.py"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
logfile=/app/logs/supervisord.log
|
logfile=/app/logs/supervisord.log
|
||||||
pidfile=/app/tmp/supervisord_pid
|
pidfile=/app/tmp/supervisord_pid
|
||||||
loglevel=%(ENV_LOG_LEVEL)s
|
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
|
; You can remove this block if you don't plan to use the programmation function
|
||||||
[program:programmation]
|
[program:programmation]
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
cronsim
|
|
||||||
fastapi
|
|
||||||
ffmpeg-python
|
|
||||||
humanize
|
|
||||||
mergedeep
|
|
||||||
psutil
|
|
||||||
redis
|
|
||||||
requests
|
|
||||||
rq
|
|
||||||
supervisor
|
|
||||||
tinydb
|
|
||||||
uvicorn
|
|
||||||
yt-dlp
|
|
||||||
Loading…
Reference in New Issue