From 43febd235f4abba1e1cc1b09ee65e4a5875a7be4 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Tue, 31 Aug 2021 11:57:34 +0200 Subject: [PATCH] bugfixing to run command as user deploy --- Dockerfile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b6c3b0..1cef3d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,13 @@ ADD dav_svn.conf /etc/apache2/sites-enabled/dav_svn.conf #RUN sed -i.bak 's/LogLevel warn/LogLevel debug/' /etc/apache2/apache2.conf RUN sed -i.bak 's/Listen 80/Listen 80\nListen 8000/' /etc/apache2/ports.conf +# allow sudo http-foreground for deploy user +ADD sudoer_deploy /etc/sudoers.d/deploy +RUN chmod 0440 /etc/sudoers.d/deploy + +# switch to user deploy +USER deploy + # setup runtime variables for apache ENV APACHE_PID_FILE=/var/run/apache2/apache2.pid ENV APACHE_LOCK_DIR=/var/lock/apache2 @@ -45,13 +52,6 @@ ENV APACHE_RUN_DIR=/var/run/apache2 ENV APACHE_RUN_USER=deploy ENV APACHE_RUN_GROUP=deploy -# allow sudo http-foreground for deploy user -ADD sudoer_deploy /etc/sudoer.d/deploy -RUN chmod 0440 /etc/sudoer.d/deploy - -# switch to user deploy -USER deploy - # set path to include ~/.local/bin ENV PATH "$PATH:/home/deploy/.local/bin" @@ -62,7 +62,5 @@ RUN pip install git+https://git.cpi.imtek.uni-freiburg.de/CPI/elab-users.git # change the working directory WORKDIR /data -USER root # Start httpd as root, but will switch to deploy user thanks to env variable -#CMD ["sudo", "httpd-foreground"] -CMD ["httpd-foreground"] \ No newline at end of file +CMD ["sudo", "httpd-foreground"]