aboutsummaryrefslogtreecommitdiff
path: root/docker-entrypoint.sh
blob: 3c6dc084a2ee19247331031fdad08700cd32a344 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

echo "You are running with user `id -u`:`id -g`"

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"
    fi
    echo "Setting umask to ${UMASK}"
    umask ${UMASK}
    mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}"
    chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}"
    su-exec "${UID}":"${GID}" python3 app/main.py
else
    echo "Running in Legacy Mode"
    python3 app/main.py
fi
bgstack15