username update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-10-24 08:29:49 +02:00
parent 428e813b58
commit 9f82cd06d3
2 changed files with 10 additions and 14 deletions

View File

@@ -3,9 +3,9 @@ FROM python:3.7
VOLUME ["/in", "/out"] VOLUME ["/in", "/out"]
RUN python -m pip install inotify \ 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 / COPY entrypoint.sh /
CMD ["/entrypoint.sh"] CMD ["/entrypoint.sh"]

View File

@@ -1,17 +1,13 @@
#!/bin/sh #!/bin/sh
DEFAULT_USER_UID=1000 DEFAULT_UID=1000
DEFAULT_USER_GID=1000 DEFAULT_GID=1000
MAYAN_USER_UID=${MAYAN_USER_UID:-${DEFAULT_USER_UID}} COPYUSER_UID=${COPYUSER_UID:-${DEFAULT_UID}}
MAYAN_USER_GID=${MAYAN_USER_GID:-${DEFAULT_USER_GID}} COPYUSER_GID=${COPYUSER_GID:-${DEFAULT_GID}}
update_uid_gid() { groupmod copyuser -g ${COPYUSER_GID} 2>/dev/null || true
groupmod mayan -g ${MAYAN_USER_GID} 2>/dev/null || true usermod copyuser -u ${COPYUSER_UID} -g ${COPYUSER_GID} 2>/dev/null
usermod mayan -u ${MAYAN_USER_UID} -g ${MAYAN_USER_GID} 2>/dev/null chown -R copyuser:copyuser /in /out
chown -R mayan:mayan /in /out
}
update_uid_gid su copyuser -c "python -u /script.py"
su mayan -c "python -u /script.py"