summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorVarac <varac@leap.se>2018-01-25 08:03:56 -0800
committerVarac <varac@leap.se>2018-01-25 08:03:56 -0800
commit4379595ebf4c49aade611a05aea9d7353da0b8ca (patch)
tree83ecc5faa28762cbb404414464c4343f8e19495c /Dockerfile
parentc5f67dc20da34ff8d01313f4a2c4c804a758c40b (diff)
parent9293398b4bf11c9641eeab03d8e1bf2049fa2b65 (diff)
Merge branch 'setup-reviewapp' into 'master'
setup review app See merge request leap/leap_se!17
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile55
1 files changed, 55 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e201f40
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,55 @@
+FROM debian:stretch
+
+MAINTAINER LEAP Encryption Access Project <sysdev@leap.se>
+LABEL Description="Run amber server behind apache to serve the LEAP website"
+
+ENV DEBIAN_FRONTEND noninteractive
+
+COPY . /var/www/leap-website/
+
+RUN apt-get update \
+ && apt-get -y dist-upgrade \
+ && apt-get install -y --no-install-recommends \
+ apache2 \
+ rubygems \
+ ruby-dev \
+ zlib1g-dev \
+ build-essential \
+ git
+
+RUN rm -rf /var/lib/apt/lists/*
+
+# Install amber
+RUN gem install amber --no-ri --no-rdoc
+
+# Generate the static html files (into public/)
+RUN cd /var/www/leap-website && amber rebuild
+
+#### Setup apache
+
+# Run on a non-priviledge port
+RUN sed -i -e 's|Listen 80|Listen 8080|' /etc/apache2/ports.conf
+RUN sed -i -e 's|VirtualHost \*:80|VirtualHost \*:8080|' /etc/apache2/sites-enabled/000-default.conf
+
+# Set the document root
+RUN sed -i -e 's|DocumentRoot /var/www/html|DocumentRoot /var/www/leap-website/public|' /etc/apache2/sites-enabled/000-default.conf
+
+# Set the amber-specific configuration for the directory so that the indexes and .htaccess will work
+RUN sed -i -e 's|</VirtualHost>| <Directory "/var/www/leap-website/public"> \n AllowOverride FileInfo Indexes Options=All,MultiViews \n Require all granted \n </Directory> \n</VirtualHost>|' /etc/apache2/sites-enabled/000-default.conf
+
+# Enable the necessary modules
+RUN /usr/sbin/a2enmod rewrite headers
+
+# Create the directories apache needs, these must be there for unpriviledged apache to run
+RUN mkdir /var/run/apache2 /var/lock/apache2 \
+ && chown :0 /var/log/apache2 /var/run/apache2 /var/lock/apache2 \
+ && chmod 774 /var/log/apache2 /var/run/apache2 /var/lock/apache2
+
+# Make the logs be displayed in the openshift logs tab
+RUN ln -sf /dev/stdout /var/log/apache2/access.log \
+ && ln -sf /dev/stdout /var/log/apache2/other_vhosts_access.log \
+ && ln -sf /dev/stderr /var/log/apache2/error.log
+
+# Run apache in the foreground
+CMD ["apache2ctl", "-D", "FOREGROUND"]
+