loyalty-cms/cms-laravel/docker/laravel/Dockerfile

41 lines
1.0 KiB
Docker

# Set up PHP for Laravel
FROM php:8.2-fpm
# Install necessary system dependencies, including oniguruma
RUN apt-get update && apt-get install -y --no-install-recommends \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
zip \
git \
unzip \
libonig-dev && \
rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Copy entire Laravel project (including artisan)
COPY . .
# Install PHP dependencies
RUN composer install --no-interaction --optimize-autoloader --no-dev
# Set permissions for storage and cache
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
RUN chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
# Make artisan executable
RUN chmod +x /var/www/html/artisan
# Expose port for PHP-FPM
EXPOSE 9000
CMD ["php-fpm"]