From 2e12a7d60caffffe7057d6e177eb87a2c296b6f5 Mon Sep 17 00:00:00 2001 From: franknstayn Date: Sun, 27 Aug 2023 19:06:42 +0800 Subject: [PATCH] updated --- Dockerfile | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0143724..a2f668a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,34 @@ -FROM alpine +# Use the official PHP image based on Alpine Linux +FROM php:7.4-fpm-alpine -ENV \ - APP_DIR="/app" \ - APP_PORT="80" +# Install system dependencies and PHP extensions +RUN apk --update --no-cache add \ + libpng-dev \ + libjpeg-turbo-dev \ + freetype-dev \ + libzip-dev \ + zip \ + unzip \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install gd pdo pdo_mysql zip -# Copy the contents of the "merchbay_laravel5" directory into the container's app directory -COPY ./ $APP_DIR +# Set the working directory in the container +WORKDIR /var/www/html -RUN apk add --update \ - curl \ - php \ - php-opcache \ - php-openssl \ - php-pdo \ - php-json \ - php-phar \ - php-dom \ - mbstring \ - && rm -rf /var/cache/apk/* +# Copy the Laravel application files to the container +COPY . . -# Download and make Composer executable -RUN curl -sS https://getcomposer.org/composer-stable.phar -o /usr/bin/composer && chmod +x /usr/bin/composer +# Set appropriate permissions for Laravel storage and bootstrap cache +RUN chown -R www-data:www-data storage bootstrap/cache -# Using the ENV variable within the RUN command -RUN cd "$APP_DIR" && composer install -v --ignore-platform-reqs +# Install Composer +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -WORKDIR $APP_DIR -CMD php artisan serve --host=0.0.0.0 --port=$APP_PORT +# Install Laravel dependencies +RUN composer install + +# Expose port 9000 for PHP-FPM +EXPOSE 9000 + +# Start PHP-FPM +CMD ["php-fpm"]