From 9aee156eee2a25ea85c05ee3e042aa18dfc19adc Mon Sep 17 00:00:00 2001 From: Alasdair Munday Date: Tue, 10 Mar 2020 10:28:23 +0000 Subject: [PATCH 1/5] made a start on a dockerfile --- Dockerfile | 16 ++++++++++++++++ README.md | 1 + docker-compose.yml | 13 +++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0f0ee39 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM php:7.2-apache + +ENV APACHE_DOCUMENT_ROOT /srv/www/christianflatshare.org +RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf +RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf + +RUN apt-get update && \ + apt-get install -y \ + zlib1g-dev\ + libxml2-dev + +RUN docker-php-ext-install mysqli mbstring zip xml + +COPY . /srv/www/christianflatshare.org + +EXPOSE 80 \ No newline at end of file diff --git a/README.md b/README.md index f4eb16d..2b7bed1 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ There is a list of projects maintained in [Github](https://github.com/ChristianF ### 1. Add the document root to your Apache2 config: VirtualHost ServerName christianflatshare.org + Document root /srv/www/christianflatshare.org diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..533367b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '2' + +services: + php: + build: ./Dockerfile + ports: + - '80:80' + depends_on: + -db + + db: + build: ./database.dockerfile + From 66670ac619349c5f4f5bf6912bb8722a6708f5ce Mon Sep 17 00:00:00 2001 From: Alasdair Munday Date: Fri, 13 Mar 2020 16:06:10 +0000 Subject: [PATCH 2/5] it works, some deprication errors on the page --- Dockerfile | 3 ++- database/Dockerfile | 6 ++++++ docker-compose.yml | 25 ++++++++++++++++++++----- includes/configuration.php | 8 ++++---- 4 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 database/Dockerfile diff --git a/Dockerfile b/Dockerfile index 0f0ee39..b7bacbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,9 @@ RUN apt-get update && \ zlib1g-dev\ libxml2-dev -RUN docker-php-ext-install mysqli mbstring zip xml +RUN docker-php-ext-install mysqli mbstring zip xml pdo_mysql COPY . /srv/www/christianflatshare.org +RUN chown -R www-data:www-data /srv/www/christianflatshare.org EXPOSE 80 \ No newline at end of file diff --git a/database/Dockerfile b/database/Dockerfile new file mode 100644 index 0000000..b1ec14e --- /dev/null +++ b/database/Dockerfile @@ -0,0 +1,6 @@ +FROM mysql:5.6 + +COPY . . +RUN zcat ./db_user.sql.gz > /docker-entrypoint-initdb.d/db_user.sql + +EXPOSE 3306 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 533367b..b522bc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,28 @@ version: '2' - services: php: - build: ./Dockerfile + build: + dockerfile: 'Dockerfile' + context: '.' ports: - '80:80' depends_on: - -db + - db + environment: + DB_NAME: cfs + DB_USER_NAME: db_user + DB_PASSWORD: account_password + DB_HOST: db + db: - build: ./database.dockerfile - + build: + dockerfile: 'Dockerfile' + context: 'database' + environment: + MYSQL_ROOT_PASSWORD: pwd + MYSQL_DATABASE: cfs + MYSQL_USER: db_user + MYSQL_PASSWORD: account_password + ports: + - '3306:3306' diff --git a/includes/configuration.php b/includes/configuration.php index 4161e69..e0a006e 100644 --- a/includes/configuration.php +++ b/includes/configuration.php @@ -12,10 +12,10 @@ define ('SERVER_ENVIRONMENT', 'PRODUCTION'); // DB constants -define('DB_HOST','localhost'); -define('DB_USER_NAME','db_user'); -define('DB_PASSWORD','account_password'); -define('DB_NAME','cfs'); +define('DB_HOST', $_ENV["DB_HOST"]); +define('DB_USER_NAME',$_ENV["DB_USER_NAME"]); +define('DB_PASSWORD',$_ENV["DB_PASSWORD"]); +define('DB_NAME',$_ENV["DB_NAME"]); // SITE contants define('SITE','www.christianflatshare.org/'); From e8df3c1567291fa0fe892adc7c8f7ebbe098dede Mon Sep 17 00:00:00 2001 From: Alasdair Munday Date: Fri, 20 Mar 2020 16:38:57 +0000 Subject: [PATCH 3/5] use docker volumes for quick code changes --- Dockerfile | 3 +- .../13/94/71877fd64564fa40efbd66290d06.php | 68 ++++++++++++ .../42/bd/703cf8c7800a9e8768fc09381eca.php | 103 ++++++++++++++++++ .../fe/68/3c163cf0b5ec38cfae8100cb5885.php | 33 ++++++ docker-compose.yml | 3 +- 5 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 cache/templates/13/94/71877fd64564fa40efbd66290d06.php create mode 100644 cache/templates/42/bd/703cf8c7800a9e8768fc09381eca.php create mode 100644 cache/templates/fe/68/3c163cf0b5ec38cfae8100cb5885.php diff --git a/Dockerfile b/Dockerfile index b7bacbb..64af8d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ RUN apt-get update && \ RUN docker-php-ext-install mysqli mbstring zip xml pdo_mysql COPY . /srv/www/christianflatshare.org + RUN chown -R www-data:www-data /srv/www/christianflatshare.org -EXPOSE 80 \ No newline at end of file +EXPOSE 80 diff --git a/cache/templates/13/94/71877fd64564fa40efbd66290d06.php b/cache/templates/13/94/71877fd64564fa40efbd66290d06.php new file mode 100644 index 0000000..c54e96b --- /dev/null +++ b/cache/templates/13/94/71877fd64564fa40efbd66290d06.php @@ -0,0 +1,68 @@ +parent = false; + + $this->blocks = array( + ); + } + + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo "
+
+ env, twig_upper_filter($this->env, $this->getAttribute((isset($context["country"]) ? $context["country"] : null), "iso")), "html", null, true); + echo ".png\" class=\"mid-flag\" /> +

"; + // line 4 + echo twig_escape_filter($this->env, $this->getAttribute((isset($context["country"]) ? $context["country"] : null), "name"), "html", null, true); + echo "

+

Change

+
+
+
Post an Advert
+
+
+ \t
+ \t
+ \t

Member Login

+ "; + // line 14 + echo (isset($context["loginForm"]) ? $context["loginForm"] : null); + echo " + env, (isset($context["FacebookLoginURL"]) ? $context["FacebookLoginURL"] : null), "html", null, true); + echo "\" class=\"fb-login\">Login with Facebook + \t
+ \t
+
+

+
+

Christian Flatshare is free to join and to use.

"; + } + + public function getTemplateName() + { + return "loginOrRegister.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 44 => 15, 40 => 14, 23 => 3, 84 => 46, 80 => 44, 76 => 42, 74 => 41, 63 => 32, 55 => 26, 47 => 20, 45 => 19, 27 => 4, 22 => 2, 19 => 1,); + } +} diff --git a/cache/templates/42/bd/703cf8c7800a9e8768fc09381eca.php b/cache/templates/42/bd/703cf8c7800a9e8768fc09381eca.php new file mode 100644 index 0000000..b1dbf95 --- /dev/null +++ b/cache/templates/42/bd/703cf8c7800a9e8768fc09381eca.php @@ -0,0 +1,103 @@ +parent = false; + + $this->blocks = array( + ); + } + + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo " +\t\t +
+\t +
"; + } + + public function getTemplateName() + { + return "header.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 84 => 46, 80 => 44, 76 => 42, 74 => 41, 63 => 32, 55 => 26, 47 => 20, 45 => 19, 27 => 4, 22 => 2, 19 => 1,); + } +} diff --git a/cache/templates/fe/68/3c163cf0b5ec38cfae8100cb5885.php b/cache/templates/fe/68/3c163cf0b5ec38cfae8100cb5885.php new file mode 100644 index 0000000..77e62ba --- /dev/null +++ b/cache/templates/fe/68/3c163cf0b5ec38cfae8100cb5885.php @@ -0,0 +1,33 @@ +parent = false; + + $this->blocks = array( + ); + } + + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo "
+
+
"; + } + + public function getTemplateName() + { + return "superheader.twig"; + } + + public function getDebugInfo() + { + return array ( 84 => 46, 80 => 44, 76 => 42, 74 => 41, 63 => 32, 55 => 26, 47 => 20, 45 => 19, 27 => 4, 22 => 2, 19 => 1,); + } +} diff --git a/docker-compose.yml b/docker-compose.yml index b522bc4..6bb82ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: build: dockerfile: 'Dockerfile' context: '.' + volumes: + - .:/srv/www/christianflatshare.org ports: - '80:80' depends_on: @@ -13,7 +15,6 @@ services: DB_USER_NAME: db_user DB_PASSWORD: account_password DB_HOST: db - db: build: From 2479f89bd3b9bc57718c07eaac40242211389dcb Mon Sep 17 00:00:00 2001 From: Alasdair Munday Date: Fri, 20 Mar 2020 17:32:51 +0000 Subject: [PATCH 4/5] added required Volume statement --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 64af8d3..72980e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ RUN docker-php-ext-install mysqli mbstring zip xml pdo_mysql COPY . /srv/www/christianflatshare.org +VOLUME [ "/srv/www/christianflatshare.org" ] + RUN chown -R www-data:www-data /srv/www/christianflatshare.org EXPOSE 80 From 485a061cfae3ff63c9e8620a4361b1f1e1cb59e1 Mon Sep 17 00:00:00 2001 From: Alasdair Munday Date: Fri, 20 Mar 2020 17:39:00 +0000 Subject: [PATCH 5/5] Added docker instructions to the readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2b7bed1..541cdf9 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,14 @@ CFS has been open sourced under the GPLv3 to allow paritpation from the technica There is a list of projects maintained in [Github](https://github.com/ChristianFlatshare/ChristianFlatshare/projects "CFS projects") +## Run with Docker +The simplest way to run and edit this project is using [docker]('https://www.docker.com/') + +With docker installed, all you have to do is run `docker-compose up`. + +The site will be served on localhost port 80 + +Any changes to the files should show up instantly! (as long as you remember to save them!) ## Installation