From ee13d3269e8a94e53db441f3a55dfaa164c4679f Mon Sep 17 00:00:00 2001 From: Frank John Begornia Date: Fri, 5 Jan 2024 21:07:55 +0800 Subject: [PATCH] update --- Dockerfile | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 39d02fc..d905962 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,46 @@ -# Use an official PHP 5.6 image with Apache -FROM php:5.6-apache +# Use the official PHP image based on Alpine Linux +FROM php:5.6-fpm-alpine -# Set the working directory to /var/www/html -WORKDIR /var/www/html +# Install system dependencies and PHP extensions +RUN apk --update --no-cache add \ + nginx \ + libpng-dev \ + libjpeg-turbo-dev \ + freetype-dev \ + libzip-dev \ + zip \ + unzip \ + libmcrypt-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install gd pdo pdo_mysql zip mcrypt -# Copy composer.lock and composer.json -COPY composer.lock composer.json /var/www/html/ +# Set the working directory in the container +WORKDIR /var/www -# Install dependencies -RUN apt-get update && \ - apt-get install -y git zip unzip && \ - docker-php-ext-install pdo pdo_mysql +# Clear cache +# RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# Copy the Laravel application files to the container +COPY . . + +# Set appropriate permissions for Laravel storage and bootstrap cache +RUN chown -R www-data:www-data storage bootstrap # Install Composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer # Install Laravel dependencies -RUN composer install --no-scripts +RUN composer install --no-plugins --no-scripts -# Copy the rest of the application code -COPY . /var/www/html/ +# Generate Laravel application key +RUN php artisan key:generate -# Set permissions -RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap +# Create directory for the socket and set permissions +RUN mkdir -p /run/php && chown www-data:www-data /run/php -# Expose port 80 and start Apache +# Copy the www.conf file to PHP-FPM pool.d directory +# COPY www.conf /usr/local/etc/php-fpm.d/www.conf + +# Expose port 9000 and start php-fpm server EXPOSE 80 -CMD ["apache2-foreground"] +CMD ["php-fpm"] \ No newline at end of file