This commit is contained in:
@@ -2,8 +2,10 @@ 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 ""
|
||||||
|
|
||||||
COPY script.py /
|
COPY --chown mayan:mayan script.py /
|
||||||
|
COPY entrypoint.sh /
|
||||||
|
|
||||||
CMD ["python", "-u", "/script.py"]
|
CMD ["/entrypoint.sh"]
|
||||||
|
|||||||
18
entrypoint.sh
Normal file
18
entrypoint.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DEFAULT_USER_UID=1000
|
||||||
|
DEFAULT_USER_GID=1000
|
||||||
|
|
||||||
|
MAYAN_USER_UID=${MAYAN_USER_UID:-${DEFAULT_USER_UID}}
|
||||||
|
MAYAN_USER_GID=${MAYAN_USER_GID:-${DEFAULT_USER_GID}}
|
||||||
|
|
||||||
|
update_uid_gid() {
|
||||||
|
echo "mayan: 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
|
||||||
|
}
|
||||||
|
|
||||||
|
update_uid_gid
|
||||||
|
|
||||||
|
su mayan -c python -u /script.py
|
||||||
Reference in New Issue
Block a user