From 203d8c1b9a62fd6366e29adfb84df4af013b6b0d Mon Sep 17 00:00:00 2001
From: Nemo <me@captnemo.in>
Date: Sat, 1 Jun 2019 14:55:01 +0530
Subject: [PATCH] [Docker] Switch Docker Image to official php base image
 (#1140)

* Switch Docker Image to official php base image

Switch from the unofficial Alpine+php image to the official php-apache image.
This has 2 advantages:

1. Official image is guaranteed to have regular updates, etc
2. The persistent Docker Alpine DNS Issue goes away;
https://github.com/gliderlabs/docker-alpine/issues/255

* [Docker] Ignore more files from Docker Image
---
 .dockerignore | 11 +++++++++--
 Dockerfile    | 12 +++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index f2bc0e8d76b..db313697054 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,7 +1,14 @@
 .git
+.gitattributes
+.github/*
+.travis.yml
 cache/*
+CONTRIBUTING.md
 DEBUG
 Dockerfile
-whitelist.txt
+phpcompatibility.xml
 phpcs.xml
-CONTRIBUTING.md
\ No newline at end of file
+phpcs.xml
+scalingo.json
+tests/*
+whitelist.txt
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 35caac84b81..7d0611be83c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,11 @@
-FROM ulsmith/alpine-apache-php7
+FROM php:7-apache
 
-COPY ./ /app/public/
+ENV APACHE_DOCUMENT_ROOT=/app
 
-RUN chown -R apache:root /app/public
\ No newline at end of file
+RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
+	&& apt-get --yes update && apt-get --yes install libxml2-dev \
+	&& docker-php-ext-install -j$(nproc) simplexml \
+	&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
+	&& sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
+
+COPY --chown=www-data:www-data ./ /app/
\ No newline at end of file