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