diff --git a/Dockerfile b/Dockerfile index 0fe21a9..7fbdcc3 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Use PHP 7.4 with Apache (compatible with Laravel 5.2 and ARM64) -FROM php:7.4-apache +# Use PHP 7.3 with Apache (compatible with Laravel 5.0) +FROM php:7.3-apache # Install system dependencies RUN apt-get update && apt-get install -y \ @@ -14,16 +14,21 @@ RUN apt-get update && apt-get install -y \ libfreetype6-dev \ libjpeg62-turbo-dev \ openssh-client \ - && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd # Install PHP extensions -RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath zip +RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath zip tokenizer + +# Install mcrypt via PECL (required for Laravel 5.0) +RUN apt-get install -y libmcrypt-dev \ + && pecl install mcrypt-1.0.4 \ + && docker-php-ext-enable mcrypt # Enable Apache mod_rewrite RUN a2enmod rewrite -# Install Composer +# Install Composer (version 1.x for better compatibility with Laravel 5.0) COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer # Set working directory @@ -47,14 +52,14 @@ RUN chown -R www-data:www-data /var/www/html \ # Create .env file if it doesn't exist RUN if [ ! -f .env ]; then cp .env.example .env; fi -# Install PHP dependencies without running post-install scripts -RUN composer install --no-dev --no-scripts --no-interaction +# Install PHP dependencies (Laravel 5.0 compatible) +RUN composer install --no-dev --no-interaction --prefer-dist # Generate application key -RUN php artisan key:generate +RUN php artisan key:generate || true -# Optimize autoloader -RUN composer dump-autoload --optimize --no-dev +# Run Laravel 5.0 optimization +RUN php artisan clear-compiled && php artisan optimize # Configure Apache DocumentRoot to point to Laravel's public directory ENV APACHE_DOCUMENT_ROOT=/var/www/html/public