From 36539462255c5cb458b98e751ba49743e551d47e Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Tue, 10 Aug 2021 16:53:21 +0100 Subject: [PATCH] added container file and entrypoint scripts --- .gitignore | 3 +-- Containerfile | 8 ++++++++ compose.yml | 9 +++++++++ docker-run.sh | 6 ++++++ entrypoint.sh | 3 +++ src/core/init.php | 2 ++ 6 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 compose.yml create mode 100644 docker-run.sh create mode 100644 entrypoint.sh diff --git a/.gitignore b/.gitignore index da59d2d..04204c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -config/config.ini -config/services.ini +config diff --git a/Containerfile b/Containerfile index f2a44ed..f8c164e 100644 --- a/Containerfile +++ b/Containerfile @@ -2,6 +2,14 @@ FROM php:7.4-apache COPY src/ /var/www/html/ +COPY ./entrypoint.sh / +RUN chmod +x /entrypoint.sh + # Use the default production configuration RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + RUN a2enmod rewrite + +EXPOSE 80 + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..05982c9 --- /dev/null +++ b/compose.yml @@ -0,0 +1,9 @@ +version: '3.3' +services: + davdiscover: + container_name: davdiscover + ports: + - '8010:80' + volumes: + - './config:/var/www/html/config' + image: pswilde/davdiscover diff --git a/docker-run.sh b/docker-run.sh new file mode 100644 index 0000000..8f2d400 --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +podman run --name davdiscover \ + --rm \ + -p "8010:80" \ + -v ./config:/var/www/html/config \ + pswilde/davdiscover diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..1340933 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +cp /var/www/html/sample-config/* /var/www/html/config/ +exec apache2-foreground diff --git a/src/core/init.php b/src/core/init.php index 2239eba..03c1077 100644 --- a/src/core/init.php +++ b/src/core/init.php @@ -29,6 +29,7 @@ class Init { // YOU REALLY SHOULD HAVE YOUR OWN CONFIG FILE!!! if (!file_exists($config)) { + echo copy(Core::root_dir()."/sample-config/services.sample.ini", $config); $config = Core::root_dir()."/sample-config/config.sample.ini"; } @@ -39,6 +40,7 @@ class Init { // YOU REALLY SHOULD HAVE YOUR OWN SERVICES FILE!!! if (!file_exists($services)) { + echo copy(Core::root_dir()."/sample-config/services.sample.ini", $services); $services = Core::root_dir()."/sample-config/services.sample.ini"; }