56 lines
1.6 KiB
Docker
56 lines
1.6 KiB
Docker
FROM php:8.2
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libpng-dev \
|
|
libjpeg62-turbo-dev \
|
|
libfreetype6-dev \
|
|
libzip-dev \
|
|
unzip \
|
|
git \
|
|
bison \
|
|
curl \
|
|
libxml2-dev \
|
|
php8.2-tokenizer \
|
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
&& docker-php-ext-install -j$(nproc) \
|
|
gd \
|
|
pdo_mysql \
|
|
zip \
|
|
tokenizer \
|
|
mbstring \
|
|
xml \
|
|
bcmath \
|
|
dom \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Configure PHP-FPM
|
|
RUN echo "[global]\nerror_log = /proc/self/fd/2\n[www]\nlisten = 0.0.0.0:9000\npm = dynamic\npm.max_children = 5\npm.start_servers = 2\npm.min_spare_servers = 1\npm.max_spare_servers = 3" > /usr/local/etc/php-fpm.d/zzz-custom.conf
|
|
|
|
# Copy entrypoint script
|
|
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
# Install Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Copy composer files first to leverage Docker cache
|
|
COPY composer.json composer.lock* ./
|
|
|
|
# Install Laravel dependencies
|
|
RUN composer install --optimize-autoloader --no-dev --ignore-platform-reqs
|
|
|
|
# Copy the rest of the Laravel application files
|
|
COPY . /var/www/html
|
|
|
|
# Set permissions
|
|
RUN chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache \
|
|
&& chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
|
|
|
|
# Set the entrypoint
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|