updated
This commit is contained in:
51
Dockerfile
51
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"]
|
||||
|
||||
Reference in New Issue
Block a user