|
|
|
FROM ubuntu:latest
|
|
|
|
|
|
|
|
# update to the latest packages
|
|
|
|
ENV DEBIAN_FRONTEND="noninteractive"
|
|
|
|
RUN apt-get update && apt-get upgrade -y
|
|
|
|
|
|
|
|
# add user that will be used to install and run the application
|
|
|
|
RUN groupadd -g 1000 deploy
|
|
|
|
RUN useradd -m -u 1000 -g deploy deploy
|
|
|
|
|
|
|
|
# install required packages for debugging
|
|
|
|
# RUN apt-get install -y vim curl lsof
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# CUSTOM PART IS BELOW HERE
|
|
|
|
#
|
|
|
|
|
|
|
|
# install required packages
|
|
|
|
RUN apt-get install -y apache2 apache2-utils libapache2-mod-svn subversion
|
|
|
|
# added more packages to separate install
|
|
|
|
# since apache2 currently has a dependency problem and
|
|
|
|
# cached docker image can be reused
|
|
|
|
RUN apt-get install -y git python3 python3-pip sudo
|
|
|
|
|
|
|
|
# copy the script to run httpd in foreground
|
|
|
|
COPY httpd-foreground /usr/local/bin/
|
|
|
|
RUN chmod u+x /usr/local/bin/httpd-foreground
|
|
|
|
|
|
|
|
# add svn site configuration
|
|
|
|
ADD dav_svn.conf /etc/apache2/sites-enabled/dav_svn.conf
|
|
|
|
|
|
|
|
# create writable directory for dav lock file
|
|
|
|
#RUN mkdir /var/lib/dav/
|
|
|
|
|
|
|
|
# adjust apache configuration files
|
|
|
|
#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
|
|
|
|
ENV APACHE_LOG_DIR=/var/log/apache2
|
|
|
|
ENV APACHE_RUN_DIR=/var/run/apache2
|
|
|
|
ENV APACHE_RUN_USER=deploy
|
|
|
|
ENV APACHE_RUN_GROUP=deploy
|
|
|
|
|
|
|
|
# set path to include ~/.local/bin
|
|
|
|
ENV PATH "$PATH:/home/deploy/.local/bin"
|
|
|
|
|
|
|
|
# install elab users management script
|
|
|
|
RUN pip install --upgrade pip
|
|
|
|
RUN pip install git+https://git.cpi.imtek.uni-freiburg.de/CPI/elab-users.git
|
|
|
|
|
|
|
|
# change the working directory
|
|
|
|
WORKDIR /data
|
|
|
|
|
|
|
|
# Start httpd as root, but will switch to deploy user thanks to env variable
|
|
|
|
CMD [
|
|
|
|
"sudo",
|
|
|
|
"APACHE_PID_FILE=/var/run/apache2/apache2.pid" ,
|
|
|
|
"APACHE_LOCK_DIR=/var/lock/apache2",
|
|
|
|
"APACHE_LOG_DIR=/var/log/apache2",
|
|
|
|
"APACHE_RUN_DIR=/var/run/apache2",
|
|
|
|
"APACHE_RUN_USER=deploy",
|
|
|
|
"APACHE_RUN_GROUP=deploy",
|
|
|
|
"httpd-foreground"
|
|
|
|
]
|