Improve Docker image

- Fixes bug in DB volume set in the wrong container.
- Adds persistence for PHP sessions between container recreations.
- Adds production settings to php.ini (error and log settings).

Fixed: pastanagapp:1
Change-Id: Ibfeee630f514f09ec033a9316c37c69441e4fd7a
diff --git a/Dockerfile b/Dockerfile
index 2a32252..7f3d694 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,15 @@
 FROM php:8.1-apache
 RUN docker-php-ext-install mysqli
 RUN docker-php-ext-enable mysqli
+RUN mkdir -p /var/phpsessions && chown www-data /var/phpsessions
+VOLUME /var/phpsessions
 RUN cd /usr/local/etc/php/conf.d/ && \
+  echo 'display_errors = Off' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
+  echo 'display_startup_errors = Off' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
+  echo 'error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
+  echo 'log_errors = On' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
   echo 'memory_limit = 128M' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
   echo 'session.gc_maxlifetime = 604800' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
-  echo 'session.cookie_lifetime = 604800' >> /usr/local/etc/php/conf.d/docker-php-custom.ini
+  echo 'session.cookie_lifetime = 604800' >> /usr/local/etc/php/conf.d/docker-php-custom.ini && \
+  echo 'session.save_path = /var/phpsessions' >> /usr/local/etc/php/conf.d/docker-php-custom.ini
 COPY ./ /var/www/html/
diff --git a/docker-compose.sample.yml b/docker-compose.sample.yml
index 285d81e..64e090a 100644
--- a/docker-compose.sample.yml
+++ b/docker-compose.sample.yml
@@ -11,7 +11,7 @@
     networks:
       - backend
     volumes:
-      - ./db-data:/var/lib/mysql
+      - phpsessions:/var/phpsessions
     restart: unless-stopped
   db:
     image: mariadb
@@ -20,7 +20,12 @@
       MARIADB_DATABASE: ${DB_NAME}
     networks:
       - backend
+    volumes:
+      - ./db-data:/var/lib/mysql
     restart: unless-stopped
 
 networks:
   backend:
+
+volumes:
+  phpsessions: