mirror of
https://github.com/alexta69/metube.git
synced 2026-03-03 02:57:02 +00:00
change UID/GID to PUID/PGID; legacy name also supported (#889)
This commit is contained in:
@@ -69,8 +69,8 @@ RUN BGUTIL_TAG="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com
|
|||||||
COPY app ./app
|
COPY app ./app
|
||||||
COPY --from=builder /metube/dist/metube ./ui/dist/metube
|
COPY --from=builder /metube/dist/metube ./ui/dist/metube
|
||||||
|
|
||||||
ENV UID=1000
|
ENV PUID=1000
|
||||||
ENV GID=1000
|
ENV PGID=1000
|
||||||
ENV UMASK=022
|
ENV UMASK=022
|
||||||
|
|
||||||
ENV DOWNLOAD_DIR /downloads
|
ENV DOWNLOAD_DIR /downloads
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ Certain values can be set via environment variables, using the `-e` parameter on
|
|||||||
|
|
||||||
### 🏠 Basic Setup
|
### 🏠 Basic Setup
|
||||||
|
|
||||||
* __UID__: User under which MeTube will run. Defaults to `1000`.
|
* __PUID__: User under which MeTube will run. Defaults to `1000` (legacy `UID` also supported).
|
||||||
* __GID__: Group under which MeTube will run. Defaults to `1000`.
|
* __PGID__: Group under which MeTube will run. Defaults to `1000` (legacy `GID` also supported).
|
||||||
* __UMASK__: Umask value used by MeTube. Defaults to `022`.
|
* __UMASK__: Umask value used by MeTube. Defaults to `022`.
|
||||||
* __DEFAULT_THEME__: Default theme to use for the UI, can be set to `light`, `dark`, or `auto`. Defaults to `auto`.
|
* __DEFAULT_THEME__: Default theme to use for the UI, can be set to `light`, `dark`, or `auto`. Defaults to `auto`.
|
||||||
* __LOGLEVEL__: Log level, can be set to `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`, or `NONE`. Defaults to `INFO`.
|
* __LOGLEVEL__: Log level, can be set to `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`, or `NONE`. Defaults to `INFO`.
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
PUID="${UID:-$PUID}"
|
||||||
|
PGID="${GID:-$PGID}"
|
||||||
|
|
||||||
echo "Setting umask to ${UMASK}"
|
echo "Setting umask to ${UMASK}"
|
||||||
umask ${UMASK}
|
umask ${UMASK}
|
||||||
echo "Creating download directory (${DOWNLOAD_DIR}), state directory (${STATE_DIR}), and temp dir (${TEMP_DIR})"
|
echo "Creating download directory (${DOWNLOAD_DIR}), state directory (${STATE_DIR}), and temp dir (${TEMP_DIR})"
|
||||||
mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
|
mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
|
||||||
|
|
||||||
if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
|
if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then
|
||||||
if [ "${UID}" -eq 0 ]; then
|
if [ "${PUID}" -eq 0 ]; then
|
||||||
echo "Warning: it is not recommended to run as root user, please check your setting of the UID environment variable"
|
echo "Warning: it is not recommended to run as root user, please check your setting of the PUID/PGID (or legacy UID/GID) environment variables"
|
||||||
fi
|
fi
|
||||||
if [ "${CHOWN_DIRS:-true}" != "false" ]; then
|
if [ "${CHOWN_DIRS:-true}" != "false" ]; then
|
||||||
echo "Changing ownership of download and state directories to ${UID}:${GID}"
|
echo "Changing ownership of download and state directories to ${PUID}:${PGID}"
|
||||||
chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
|
chown -R "${PUID}":"${PGID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}"
|
||||||
fi
|
fi
|
||||||
echo "Starting BgUtils POT Provider"
|
echo "Starting BgUtils POT Provider"
|
||||||
gosu "${UID}":"${GID}" bgutil-pot server >/tmp/bgutil-pot.log 2>&1 &
|
gosu "${PUID}":"${PGID}" bgutil-pot server >/tmp/bgutil-pot.log 2>&1 &
|
||||||
echo "Running MeTube as user ${UID}:${GID}"
|
echo "Running MeTube as user ${PUID}:${PGID}"
|
||||||
exec gosu "${UID}":"${GID}" python3 app/main.py
|
exec gosu "${PUID}":"${PGID}" python3 app/main.py
|
||||||
else
|
else
|
||||||
echo "User set by docker; running MeTube as `id -u`:`id -g`"
|
echo "User set by docker; running MeTube as `id -u`:`id -g`"
|
||||||
echo "Starting BgUtils POT Provider"
|
echo "Starting BgUtils POT Provider"
|
||||||
|
|||||||
Reference in New Issue
Block a user