From 9f82cd06d3ecee24e24eae739124f24412ed1726 Mon Sep 17 00:00:00 2001 From: Matthias Bilger Date: Thu, 24 Oct 2019 08:29:49 +0200 Subject: [PATCH] username update --- Dockerfile | 4 ++-- entrypoint.sh | 20 ++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0ca70c6..8dbc52c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,9 +3,9 @@ FROM python:3.7 VOLUME ["/in", "/out"] RUN python -m pip install inotify \ - && adduser mayan --disabled-password --disabled-login --no-create-home --gecos "" + && adduser copyuser --disabled-password --disabled-login --no-create-home --gecos "" -COPY --chown=mayan:mayan script.py / +COPY --chown=copyuser:copyuser script.py / COPY entrypoint.sh / CMD ["/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 734a32a..14a2852 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,17 +1,13 @@ #!/bin/sh -DEFAULT_USER_UID=1000 -DEFAULT_USER_GID=1000 +DEFAULT_UID=1000 +DEFAULT_GID=1000 -MAYAN_USER_UID=${MAYAN_USER_UID:-${DEFAULT_USER_UID}} -MAYAN_USER_GID=${MAYAN_USER_GID:-${DEFAULT_USER_GID}} +COPYUSER_UID=${COPYUSER_UID:-${DEFAULT_UID}} +COPYUSER_GID=${COPYUSER_GID:-${DEFAULT_GID}} -update_uid_gid() { - groupmod mayan -g ${MAYAN_USER_GID} 2>/dev/null || true - usermod mayan -u ${MAYAN_USER_UID} -g ${MAYAN_USER_GID} 2>/dev/null - chown -R mayan:mayan /in /out -} +groupmod copyuser -g ${COPYUSER_GID} 2>/dev/null || true +usermod copyuser -u ${COPYUSER_UID} -g ${COPYUSER_GID} 2>/dev/null +chown -R copyuser:copyuser /in /out -update_uid_gid - -su mayan -c "python -u /script.py" +su copyuser -c "python -u /script.py"