# Use PHP 7.4 Alpine (compatible with Laravel 6) FROM php:7.4-fpm-alpine # Install required dependencies RUN apk add --no-cache \ oniguruma-dev \ libpng-dev \ libjpeg-turbo-dev \ libwebp-dev \ freetype-dev \ libzip-dev \ zip \ unzip \ openssl # Laravel 6 requires OpenSSL # Install required extensions RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ && docker-php-ext-install gd pdo pdo_mysql bcmath mbstring tokenizer zip # Install Composer COPY --from=composer:2.7 /usr/bin/composer /usr/bin/composer # Set working directory WORKDIR /var/www # Copy Laravel application files BEFORE running composer install COPY . /var/www/ # Ensure composer.json exists before running install RUN if [ -f "composer.json" ]; then composer install --no-dev --optimize-autoloader; else echo "composer.json not found!"; fi # Ensure required Laravel directories exist and set permissions RUN mkdir -p /var/www/storage /var/www/bootstrap/cache && \ chown -R www-data:www-data /var/www && \ chmod -R 775 /var/www/storage /var/www/bootstrap/cache # Expose PHP-FPM port EXPOSE 9000 # Start PHP-FPM server CMD ["php-fpm"]