Browse Source

Update Dockerfile, docker-compose.yml, config/docker-entrypoint.sh, config/apache-config.conf files

Jan Behrens 2 years ago
parent
commit
a940b75668
4 changed files with 73 additions and 0 deletions
  1. 39 0
      Dockerfile
  2. 21 0
      config/apache-config.conf
  3. 6 0
      config/docker-entrypoint.sh
  4. 7 0
      docker-compose.yml

+ 39 - 0
Dockerfile

@@ -0,0 +1,39 @@
+FROM ubuntu:bionic
+
+RUN apt-get update && \
+    apt-get -y upgrade && \
+    DEBIAN_FRONTEND=noninteractive apt-get -y install \
+        apache2 php7.2 libapache2-mod-php7.2 libcap2-bin curl
+
+RUN a2enmod php7.2
+
+#RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/apache2/php.ini
+#RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php/7.0/apache2/php.ini
+
+ENV APACHE_RUN_USER 1000220000
+ENV APACHE_RUN_GROUP 5100
+ENV APACHE_LOG_DIR /var/log/apache2
+ENV APACHE_LOCK_DIR /var/lock/apache2
+ENV APACHE_PID_FILE /var/run/apache2.pid
+
+RUN mkdir -p /var/log/apache2 && chown -R ${APACHE_RUN_USER} /var/log/apache2 && \
+    mkdir -p /var/lock/apache2 && chown -R ${APACHE_RUN_USER} /var/lock/apache2 && \
+    mkdir -p /var/run/apache2 && chown -R ${APACHE_RUN_USER} /var/run/apache2 && \
+    setcap 'cap_net_bind_service=+ep' /usr/sbin/apache2
+
+ADD config/apache-config.conf /etc/apache2/sites-enabled/000-default.conf
+ADD config/docker-entrypoint.sh /docker-entrypoint.sh
+RUN chmod +x /docker-entrypoint.sh
+
+RUN rm -rf /var/www/html/*
+ADD . /var/www/html
+RUN chown -R ${APACHE_RUN_USER} /var/www/html
+
+VOLUME /var/www/html/data
+
+USER ${APACHE_RUN_USER}
+
+EXPOSE 80
+
+WORKDIR /var/www/html
+ENTRYPOINT /docker-entrypoint.sh

+ 21 - 0
config/apache-config.conf

@@ -0,0 +1,21 @@
+<VirtualHost *:80>
+
+  #ServerAdmin example@kit.edu
+  #ServerName example.kit.edu
+
+  DocumentRoot /var/www/html/public
+
+  <Directory /var/www/html/public>
+      Options -Indexes +FollowSymLinks +MultiViews
+      DirectoryIndex index.html
+      AllowOverride All
+      Order deny,allow
+      Allow from all
+  </Directory>
+
+  ErrorLog /dev/stderr
+  #TransferLog /dev/stdout
+
+  CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+</VirtualHost>

+ 6 - 0
config/docker-entrypoint.sh

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+/usr/bin/id
+
+echo "Starting server process"
+/usr/sbin/apache2ctl -D FOREGROUND $@ || exit $?

+ 7 - 0
docker-compose.yml

@@ -0,0 +1,7 @@
+version: '3'
+services:
+  web:
+    build: .
+    ports:
+     - "80:80"
+    volumes: