From e2ce24332912fd0fa4ba01f8ee91adab98c6a84f Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 14 Mar 2019 23:02:20 +0100 Subject: [PATCH] Define and run the entrypoint as non-root --- Dockerfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index c4647a3..a3b62b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,5 @@ FROM debian:jessie -#ENV UID=1000 -#ENV GID=1000 -#RUN groupadd -g $GID -o seadrive -#RUN useradd -m -u $UID -g $GID -o -s /bin/bash seadrive - ENV DEBIAN_FRONTEND noninteractive COPY assets/seafile.list /etc/apt/sources.list.d/ @@ -17,6 +12,17 @@ RUN apt-key adv \ RUN apt-get update ;\ apt-get install -o Dpkg::Options::="--force-confold" -y seafile-cli supervisor -RUN mkdir /seafile; mkdir /volume +RUN mkdir /.seafile; mkdir /volume; touch supervisord.log + +ARG UNAME=seafuser +ENV UID=1000 +ENV GID=1000 +RUN groupadd -g $GID -o $UNAME ;\ + useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\ + chown $UID.$GID -R /.seafile ;\ + chown $UID.$GID -R /volume ;\ + chown $UID.$GID /supervisord.log ;\ + chown $UID.$GID /supervisord.conf +USER $UNAME ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file