This commit is contained in:
franknstayn
2023-08-27 19:06:42 +08:00
parent 8f2afd8008
commit 2e12a7d60c

View File

@@ -1,29 +1,34 @@
FROM alpine # Use the official PHP image based on Alpine Linux
FROM php:7.4-fpm-alpine
ENV \ # Install system dependencies and PHP extensions
APP_DIR="/app" \ RUN apk --update --no-cache add \
APP_PORT="80" 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 # Set the working directory in the container
COPY ./ $APP_DIR WORKDIR /var/www/html
RUN apk add --update \ # Copy the Laravel application files to the container
curl \ COPY . .
php \
php-opcache \
php-openssl \
php-pdo \
php-json \
php-phar \
php-dom \
mbstring \
&& rm -rf /var/cache/apk/*
# Download and make Composer executable # Set appropriate permissions for Laravel storage and bootstrap cache
RUN curl -sS https://getcomposer.org/composer-stable.phar -o /usr/bin/composer && chmod +x /usr/bin/composer RUN chown -R www-data:www-data storage bootstrap/cache
# Using the ENV variable within the RUN command # Install Composer
RUN cd "$APP_DIR" && composer install -v --ignore-platform-reqs RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR $APP_DIR # Install Laravel dependencies
CMD php artisan serve --host=0.0.0.0 --port=$APP_PORT RUN composer install
# Expose port 9000 for PHP-FPM
EXPOSE 9000
# Start PHP-FPM
CMD ["php-fpm"]