aboutsummaryrefslogtreecommitdiff
path: root/docker-entrypoint.sh
diff options
context:
space:
mode:
authorAlex Shnitman <alexta69@gmail.com>2022-06-19 22:15:42 +0300
committerAlex Shnitman <alexta69@gmail.com>2022-06-19 22:19:13 +0300
commitdccf8d5bf67ffbf52584b24f1d8c82eb28e3ce36 (patch)
tree67b4a8a9b752bcd64af49664fb68c0cee6ac76e8 /docker-entrypoint.sh
parentMerge branch 'master' of https://github.com/alexta69/metube into VergilGao/ma... (diff)
downloadmetube-dccf8d5bf67ffbf52584b24f1d8c82eb28e3ce36.tar.gz
metube-dccf8d5bf67ffbf52584b24f1d8c82eb28e3ce36.tar.bz2
metube-dccf8d5bf67ffbf52584b24f1d8c82eb28e3ce36.zip
refactor of the entrypoint feature
Diffstat (limited to 'docker-entrypoint.sh')
-rw-r--r--docker-entrypoint.sh15
1 files changed, 8 insertions, 7 deletions
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 3c6dc08..ccf58d7 100644
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -1,18 +1,19 @@
#!/bin/sh
-echo "You are running with user `id -u`:`id -g`"
+echo "Setting umask to ${UMASK}"
+umask ${UMASK}
+echo "Creating download directory ${DOWNLOAD_DIR} and state directory ${STATE_DIR}"
+mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}"
if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
- echo "Running in New Mode"
if [ "${UID}" -eq 0 ]; then
- echo "Warning, it is not recommended to run as root user, please check if you have set the UID environment variable"
+ echo "Warning: it is not recommended to run as root user, please check your setting of the UID environment variable"
fi
- echo "Setting umask to ${UMASK}"
- umask ${UMASK}
- mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}"
+ echo "Changing ownership of download and state directories to ${UID}:${GID}"
chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}"
+ echo "Running MeTube as user ${UID}:${GID}"
su-exec "${UID}":"${GID}" python3 app/main.py
else
- echo "Running in Legacy Mode"
+ echo "User set by docker; running MeTube as `id -u`:`id -g`"
python3 app/main.py
fi
bgstack15