From dccf8d5bf67ffbf52584b24f1d8c82eb28e3ce36 Mon Sep 17 00:00:00 2001 From: Alex Shnitman Date: Sun, 19 Jun 2022 22:15:42 +0300 Subject: refactor of the entrypoint feature --- docker-entrypoint.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'docker-entrypoint.sh') 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 -- cgit