Browse Source

running commands as user deploy

main
Holger Frey 3 years ago
parent
commit
edb7f7a2b8
  1. 13
      Dockerfile
  2. 1
      sudoer_deploy

13
Dockerfile

@ -45,13 +45,22 @@ ENV APACHE_RUN_DIR=/var/run/apache2
ENV APACHE_RUN_USER=deploy ENV APACHE_RUN_USER=deploy
ENV APACHE_RUN_GROUP=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 USER deploy
# set path to include ~/.local/bin
ENV PATH "$PATH:/home/deploy/.local/bin" ENV PATH "$PATH:/home/deploy/.local/bin"
# install elab users management script
RUN pip install --upgrade pip RUN pip install --upgrade pip
RUN pip install git+https://git.cpi.imtek.uni-freiburg.de/CPI/elab-users.git RUN pip install git+https://git.cpi.imtek.uni-freiburg.de/CPI/elab-users.git
# change the working directory
WORKDIR /data WORKDIR /data
USER root
# Start httpd as root, but will switch to deploy user thanks to env variable # Start httpd as root, but will switch to deploy user thanks to env variable
CMD ["httpd-foreground"] CMD ["sudo", "httpd-foreground"]

1
sudoer_deploy

@ -0,0 +1 @@
deploy ALL=(ALL) NOPASSWD:/usr/local/bin/httpd-foreground
Loading…
Cancel
Save