diff --git a/Dockerfile b/Dockerfile index 230b8ec..363fe81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,8 +29,15 @@ RUN mkdir -p /var/www/html/app/Database && \ chown -R www-data:www-data /var/www/html && \ chmod -R 755 /var/www/html +# Copy Entrypoint +COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + # Expose port EXPOSE 80 -# Start Supervisor (which starts Nginx & PHP-FPM) +# Use Entrypoint +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] + +# Start Supervisor CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] diff --git a/app/Config/SiteConfig.php b/app/Config/SiteConfig.php index 23900b4..532a983 100644 --- a/app/Config/SiteConfig.php +++ b/app/Config/SiteConfig.php @@ -3,7 +3,7 @@ namespace App\Config; class SiteConfig { const APP_NAME = 'MIVO'; - const APP_VERSION = 'v1.2.1'; + const APP_VERSION = 'v1.2.2'; const APP_FULL_NAME = 'MIVO - Mikrotik Voucher'; const CREDIT_NAME = 'MivoDev'; const CREDIT_URL = 'https://github.com/mivodev'; diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..df0ab03 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +# Ensure Database directory exists +mkdir -p /var/www/html/app/Database + +# Fix permissions for the Database directory +# This is crucial for SQLite when volumes are mounted from host +if [ -d "/var/www/html/app/Database" ]; then + chown -R www-data:www-data /var/www/html/app/Database + chmod -R 775 /var/www/html/app/Database +fi + +# Also ensure .env is writable if it exists, or create it from example +if [ ! -f "/var/www/html/.env" ] && [ -f "/var/www/html/.env.example" ]; then + cp /var/www/html/.env.example /var/www/html/.env + chown www-data:www-data /var/www/html/.env +fi + +if [ -f "/var/www/html/.env" ]; then + chmod 664 /var/www/html/.env +fi + +# Execute the command passed to docker run (usually supervisor) +exec "$@" diff --git a/package.json b/package.json index fe65819..fe6dde8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mivo", - "version": "1.2.1", + "version": "1.2.2", "description": "This is a complete rewrite of Mivo using a modern MVC architecture.\r It runs on a lightweight custom core designed for performance on low-end devices (STB/Android).", "main": "index.js", "scripts": {