dev #1
25
Dockerfile
25
Dockerfile
@@ -1,5 +1,5 @@
|
|||||||
# Use PHP 7.4 with Apache (compatible with Laravel 5.2 and ARM64)
|
# Use PHP 7.3 with Apache (compatible with Laravel 5.0)
|
||||||
FROM php:7.4-apache
|
FROM php:7.3-apache
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
@@ -14,16 +14,21 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
libjpeg62-turbo-dev \
|
libjpeg62-turbo-dev \
|
||||||
openssh-client \
|
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
|
&& docker-php-ext-install -j$(nproc) gd
|
||||||
|
|
||||||
# Install PHP extensions
|
# 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
|
# Enable Apache mod_rewrite
|
||||||
RUN a2enmod 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
|
COPY --from=composer:1.10 /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
# Set working directory
|
# 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
|
# Create .env file if it doesn't exist
|
||||||
RUN if [ ! -f .env ]; then cp .env.example .env; fi
|
RUN if [ ! -f .env ]; then cp .env.example .env; fi
|
||||||
|
|
||||||
# Install PHP dependencies without running post-install scripts
|
# Install PHP dependencies (Laravel 5.0 compatible)
|
||||||
RUN composer install --no-dev --no-scripts --no-interaction
|
RUN composer install --no-dev --no-interaction --prefer-dist
|
||||||
|
|
||||||
# Generate application key
|
# Generate application key
|
||||||
RUN php artisan key:generate
|
RUN php artisan key:generate || true
|
||||||
|
|
||||||
# Optimize autoloader
|
# Run Laravel 5.0 optimization
|
||||||
RUN composer dump-autoload --optimize --no-dev
|
RUN php artisan clear-compiled && php artisan optimize
|
||||||
|
|
||||||
# Configure Apache DocumentRoot to point to Laravel's public directory
|
# Configure Apache DocumentRoot to point to Laravel's public directory
|
||||||
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
|
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
|
||||||
|
|||||||
Reference in New Issue
Block a user