feat: update Dockerfile and AppServiceProvider for PHP 7.2 compatibility and improved error handling
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 7m7s
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 7m7s
This commit is contained in:
33
Dockerfile
33
Dockerfile
@@ -1,10 +1,10 @@
|
||||
# Use PHP 7.0 with Apache (has native mcrypt support for Laravel 5.0)
|
||||
FROM php:7.0-apache
|
||||
# Use PHP 7.2 with Apache (mcrypt available via PECL, compatible with Laravel 5.0)
|
||||
FROM php:7.2-apache
|
||||
|
||||
# Update to use archived Debian repositories
|
||||
# Redirect to archived Debian Buster repositories (EOL)
|
||||
RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list \
|
||||
&& sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list \
|
||||
&& sed -i '/stretch-updates/d' /etc/apt/sources.list
|
||||
&& sed -i '/buster-updates/d' /etc/apt/sources.list
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y --allow-unauthenticated \
|
||||
@@ -18,17 +18,24 @@ RUN apt-get update && apt-get install -y --allow-unauthenticated \
|
||||
libfreetype6-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
openssh-client \
|
||||
libzip-dev \
|
||||
&& 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 (mcrypt is built-in for PHP 7.0)
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath mcrypt tokenizer zip
|
||||
# Install mcrypt via PECL (removed from core in PHP 7.2)
|
||||
RUN pecl install mcrypt-1.0.4 && docker-php-ext-enable mcrypt
|
||||
|
||||
# Suppress E_DEPRECATED so PECL mcrypt functions don't trigger ErrorException in Laravel 5.0
|
||||
RUN echo "error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT" > /usr/local/etc/php/conf.d/suppress-deprecated.ini
|
||||
|
||||
# Install PHP extensions
|
||||
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath tokenizer zip
|
||||
|
||||
# Enable Apache mod_rewrite
|
||||
RUN a2enmod rewrite
|
||||
|
||||
# Install Composer (version 1.x for better compatibility with Laravel 5.0)
|
||||
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer
|
||||
# Install Composer 2.2 (LTS version supporting PHP 7.2+)
|
||||
COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
@@ -51,8 +58,8 @@ 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 (Laravel 5.0 compatible)
|
||||
RUN composer install --no-dev --no-interaction --prefer-dist
|
||||
# Install PHP dependencies (--no-plugins skips kylekatarnls/update-helper which is Composer 1 only)
|
||||
RUN composer install --no-dev --no-interaction --prefer-dist --no-plugins
|
||||
|
||||
# Generate application key
|
||||
RUN php artisan key:generate || true
|
||||
@@ -60,11 +67,7 @@ RUN php artisan key:generate || true
|
||||
# Run Laravel 5.0 optimization
|
||||
RUN php artisan clear-compiled && php artisan optimize
|
||||
|
||||
# Note: yakpro-po obfuscation requires PHP 7.1+, incompatible with PHP 7.0
|
||||
# For code protection with PHP 7.0, consider:
|
||||
# 1. ionCube Encoder (commercial, most secure)
|
||||
# 2. Keeping source code private and using proper access controls
|
||||
# 3. Using --optimize flag in composer (already done above)
|
||||
# Note: PHP 7.2 is compatible with Laravel 5.0 and yakpro-po obfuscation
|
||||
|
||||
# Configure Apache DocumentRoot to point to Laravel's public directory
|
||||
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
|
||||
|
||||
Reference in New Issue
Block a user