docker: switch to non-root user
This commit is contained in:
parent
e7bfbca9dc
commit
4131813fa5
2 changed files with 12 additions and 2 deletions
|
@ -8,7 +8,7 @@ RUN apt-get update \
|
||||||
&& truncate -s 0 /var/log/*log
|
&& truncate -s 0 /var/log/*log
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends make build-essential inotify-tools chromium \
|
&& apt-get install -y --no-install-recommends make build-essential inotify-tools chromium gosu \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||||
&& truncate -s 0 /var/log/*log
|
&& truncate -s 0 /var/log/*log
|
||||||
|
@ -22,5 +22,6 @@ ENV LC_ALL=C
|
||||||
|
|
||||||
RUN make prepare
|
RUN make prepare
|
||||||
|
|
||||||
|
|
||||||
ENTRYPOINT ["/app/docker/entrypoint.sh"]
|
ENTRYPOINT ["/app/docker/entrypoint.sh"]
|
||||||
CMD ["watch"]
|
CMD ["watch"]
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -u
|
||||||
|
set -e
|
||||||
|
|
||||||
ARGS="$*"
|
ARGS="$*"
|
||||||
echo "Arguments: $ARGS"
|
echo "Arguments: $ARGS"
|
||||||
|
|
||||||
exec make "$@"
|
EXT_UID=${EXT_UID:-999}
|
||||||
|
EXT_GID=${EXT_GID:-999}
|
||||||
|
|
||||||
|
groupadd -g "$EXT_GID" appuser
|
||||||
|
useradd -r -u "$EXT_UID" -g appuser appuser
|
||||||
|
|
||||||
|
exec gosu appuser make "$@"
|
||||||
|
|
Loading…
Reference in a new issue