mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-09 01:11:28 +03:00
Merge pull request #598 from GlassedSilver/master
Fixing Ubuntu-introduced issues and further improvements
This commit is contained in:
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -8,9 +8,9 @@ on:
|
|||||||
- '.vscode/**'
|
- '.vscode/**'
|
||||||
- 'chrome-extension/**'
|
- 'chrome-extension/**'
|
||||||
- 'releases/**'
|
- 'releases/**'
|
||||||
|
- '**/**.md'
|
||||||
- '**.crx'
|
- '**.crx'
|
||||||
- '**.pem'
|
- '**.pem'
|
||||||
- '**.md'
|
|
||||||
- '.dockerignore'
|
- '.dockerignore'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
|
|
||||||
|
|||||||
19
Dockerfile
19
Dockerfile
@@ -1,13 +1,12 @@
|
|||||||
FROM ubuntu:22.04 AS ffmpeg
|
FROM ubuntu:22.04 AS ffmpeg
|
||||||
|
|
||||||
ENV UID=1000 \
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
GID=1000 \
|
|
||||||
USER=youtube \
|
|
||||||
DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
COPY docker-build.sh .
|
COPY docker-build.sh .
|
||||||
RUN sh ./docker-build.sh
|
RUN sh ./docker-build.sh
|
||||||
|
|
||||||
|
#--------------# Stage 2
|
||||||
|
|
||||||
FROM ubuntu:22.04 as frontend
|
FROM ubuntu:22.04 as frontend
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
@@ -20,9 +19,6 @@ RUN apt-get update && apt-get -y install \
|
|||||||
# spares us this spaghetti approach: https://stackoverflow.com/a/60547197
|
# spares us this spaghetti approach: https://stackoverflow.com/a/60547197
|
||||||
npm && \
|
npm && \
|
||||||
apt-get install -f && \
|
apt-get install -f && \
|
||||||
apt-get autoremove --purge && \
|
|
||||||
apt-get autoremove && \
|
|
||||||
apt-get clean && \
|
|
||||||
npm config set strict-ssl false && \
|
npm config set strict-ssl false && \
|
||||||
npm install -g @angular/cli
|
npm install -g @angular/cli
|
||||||
|
|
||||||
@@ -34,7 +30,7 @@ COPY [ "angular.json", "tsconfig.json", "/build/" ]
|
|||||||
COPY [ "src/", "/build/src/" ]
|
COPY [ "src/", "/build/src/" ]
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
#--------------#
|
#--------------# Final Stage
|
||||||
|
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
@@ -51,6 +47,7 @@ RUN apt-get update && apt-get -y install \
|
|||||||
npm \
|
npm \
|
||||||
python2 \
|
python2 \
|
||||||
python3 \
|
python3 \
|
||||||
|
gosu \
|
||||||
atomicparsley && \
|
atomicparsley && \
|
||||||
apt-get install -f && \
|
apt-get install -f && \
|
||||||
apt-get autoremove --purge && \
|
apt-get autoremove --purge && \
|
||||||
@@ -59,8 +56,8 @@ RUN apt-get update && apt-get -y install \
|
|||||||
rm -rf /var/lib/apt
|
rm -rf /var/lib/apt
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
|
COPY --chown=$UID:$GID --from=ffmpeg [ "/usr/local/bin/ffmpeg", "/usr/local/bin/ffmpeg" ]
|
||||||
COPY --from=ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ffprobe
|
COPY --chown=$UID:$GID --from=ffmpeg [ "/usr/local/bin/ffprobe", "/usr/local/bin/ffprobe" ]
|
||||||
COPY --chown=$UID:$GID [ "backend/package.json", "backend/package-lock.json", "/app/" ]
|
COPY --chown=$UID:$GID [ "backend/package.json", "backend/package-lock.json", "/app/" ]
|
||||||
ENV PM2_HOME=/app/pm2
|
ENV PM2_HOME=/app/pm2
|
||||||
RUN npm config set strict-ssl false && \
|
RUN npm config set strict-ssl false && \
|
||||||
@@ -71,5 +68,5 @@ COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/
|
|||||||
COPY --chown=$UID:$GID [ "/backend/", "/app/" ]
|
COPY --chown=$UID:$GID [ "/backend/", "/app/" ]
|
||||||
|
|
||||||
EXPOSE 17442
|
EXPOSE 17442
|
||||||
# ENTRYPOINT [ "/app/entrypoint.sh" ]
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
CMD [ "pm2-runtime", "pm2.config.js" ]
|
CMD [ "pm2-runtime", "pm2.config.js" ]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fi
|
|||||||
# chown current working directory to current user
|
# chown current working directory to current user
|
||||||
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
if [ "$*" = "$CMD" ] && [ "$(id -u)" = "0" ]; then
|
||||||
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos."
|
find . \! -user "$UID" -exec chown "$UID:$GID" -R '{}' + || echo "WARNING! Could not change directory ownership. If you manage permissions externally this is fine, otherwise you may experience issues when downloading or deleting videos."
|
||||||
exec su-exec "$UID:$GID" "$0" "$@"
|
exec gosu "$UID:$GID" "$0" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
58
backend/fix-scripts/001-fix_download_permissions.sh
Normal file
58
backend/fix-scripts/001-fix_download_permissions.sh
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# INTERACTIVE PERMISSIONS FIX SCRIPT FOR YTDL-M
|
||||||
|
# Date: 2022-05-03
|
||||||
|
|
||||||
|
# If you want to run this script on a bare-metal installation instead of within Docker
|
||||||
|
# make sure that the paths configured below match your paths! (it's wise to use the full paths)
|
||||||
|
# USAGE: within your container's bash shell:
|
||||||
|
# chmod -R +x ./fix-scripts/
|
||||||
|
# ./fix-scripts/001-fix_download_permissions.sh
|
||||||
|
|
||||||
|
# User defines / Docker env defaults
|
||||||
|
PATH_SUBS=/app/subscriptions
|
||||||
|
PATH_AUDIO=/app/audio
|
||||||
|
PATH_VIDS=/app/video
|
||||||
|
|
||||||
|
clear -x
|
||||||
|
echo "\n"
|
||||||
|
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - # horizontal line
|
||||||
|
echo "Welcome to the INTERACTIVE PERMISSIONS FIX SCRIPT FOR YTDL-M."
|
||||||
|
echo "This script will set YTDL-M's download paths' owner to ${USER} (${UID}:${GID})"
|
||||||
|
echo "and permissions to the default of 644."
|
||||||
|
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' - # horizontal line
|
||||||
|
echo "\n"
|
||||||
|
|
||||||
|
# check whether dirs exist
|
||||||
|
i=0
|
||||||
|
[ -d $PATH_SUBS ] && i=$((i+1)) && echo "✔ (${i}/3) Found Subscriptions directory at ${PATH_SUBS}"
|
||||||
|
[ -d $PATH_AUDIO ] && i=$((i+1)) && echo "✔ (${i}/3) Found Audio directory at ${PATH_AUDIO}"
|
||||||
|
[ -d $PATH_VIDS ] && i=$((i+1)) && echo "✔ (${i}/3) Found Video directory at ${PATH_VIDS}"
|
||||||
|
|
||||||
|
# Ask to proceed or cancel, exit on missing paths
|
||||||
|
case $i in
|
||||||
|
0)
|
||||||
|
echo "\nCouldn't find any download path to fix permissions for! \nPlease edit this script to configure!"
|
||||||
|
exit 2;;
|
||||||
|
3)
|
||||||
|
echo "\nFound all download paths to fix permissions for. \nProceed? (Y/N)";;
|
||||||
|
*)
|
||||||
|
echo "\nOnly found ${i} out of 3 download paths! Something about this script's config must be wrong. \nProceed anyways? (Y/N)";;
|
||||||
|
esac
|
||||||
|
old_stty_cfg=$(stty -g)
|
||||||
|
stty raw -echo ; answer=$(head -c 1) ; stty $old_stty_cfg # Careful playing with stty
|
||||||
|
if echo "$answer" | grep -iq "^y" ;then
|
||||||
|
echo "\n Running jobs now... (this may take a while)\n"
|
||||||
|
[ -d $PATH_SUBS ] && chown "$UID:$GID" -R $PATH_SUBS && echo "✔ Set owner of ${PATH_SUBS} to ${USER}."
|
||||||
|
[ -d $PATH_SUBS ] && chmod 644 -R $PATH_SUBS && echo "✔ Set permissions of ${PATH_SUBS} to 644."
|
||||||
|
[ -d $PATH_AUDIO ] && chown "$UID:$GID" -R $PATH_AUDIO && echo "✔ Set owner of ${PATH_AUDIO} to ${USER}."
|
||||||
|
[ -d $PATH_AUDIO ] && chmod 644 -R $PATH_AUDIO && echo "✔ Set permissions of ${PATH_AUDIO} to 644."
|
||||||
|
[ -d $PATH_VIDS ] && chown "$UID:$GID" -R $PATH_VIDS && echo "✔ Set owner of ${PATH_VIDS} to ${USER}."
|
||||||
|
[ -d $PATH_VIDS ] && chmod 644 -R $PATH_VIDS && echo "✔ Set permissions of ${PATH_VIDS} to 644."
|
||||||
|
echo "\n✔ Done."
|
||||||
|
echo "\n If you noticed file access errors those MAY be due to currently running downloads."
|
||||||
|
echo " Feel free to re-run this script, however download parts should have correct file permissions anyhow. :)"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
echo "\nOkay, bye."
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user