updated
This commit is contained in:
67
Dockerfile
67
Dockerfile
@@ -1,41 +1,46 @@
|
|||||||
# Use an official PHP 5.6 Apache image
|
# Use the official PHP image based on Alpine Linux
|
||||||
FROM php:5.6-apache
|
FROM php:5.6-fpm-alpine
|
||||||
|
|
||||||
# Set the working directory inside the container
|
# Install system dependencies and PHP extensions
|
||||||
WORKDIR /var/www/html
|
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
|
||||||
|
|
||||||
# Install required dependencies
|
# Set the working directory in the container
|
||||||
RUN apt-get update && \
|
WORKDIR /var/www
|
||||||
apt-get install -y \
|
|
||||||
libfreetype6-dev \
|
|
||||||
libjpeg62-turbo-dev \
|
|
||||||
libpng12-dev \
|
|
||||||
libmcrypt-dev \
|
|
||||||
libzip-dev \
|
|
||||||
unzip \
|
|
||||||
git \
|
|
||||||
curl
|
|
||||||
|
|
||||||
# Install Composer globally
|
# Clear cache
|
||||||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
# RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Enable required PHP extensions
|
# Copy the Laravel application files to the container
|
||||||
RUN docker-php-ext-install pdo_mysql mbstring zip mcrypt
|
|
||||||
|
|
||||||
# Enable Apache modules
|
|
||||||
RUN a2enmod rewrite
|
|
||||||
|
|
||||||
# Copy the Laravel application files into the container
|
|
||||||
COPY . .
|
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
|
# Install Laravel dependencies
|
||||||
RUN composer install --no-interaction --optimize-autoloader
|
RUN composer install --no-plugins --no-scripts
|
||||||
|
|
||||||
# Set permissions
|
# Generate Laravel application key
|
||||||
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap
|
RUN php artisan key:generate
|
||||||
|
|
||||||
# Expose port 80
|
# Create directory for the socket and set permissions
|
||||||
EXPOSE 80
|
RUN mkdir -p /run/php && chown www-data:www-data /run/php
|
||||||
|
|
||||||
# Start the Apache server
|
# Copy the www.conf file to PHP-FPM pool.d directory
|
||||||
CMD ["apache2-foreground"]
|
# COPY www.conf /usr/local/etc/php-fpm.d/www.conf
|
||||||
|
|
||||||
|
# Expose port 9000 and start php-fpm server
|
||||||
|
EXPOSE 9000
|
||||||
|
CMD ["php-fpm"]
|
||||||
Reference in New Issue
Block a user