45 lines
1.1 KiB
Docker
45 lines
1.1 KiB
Docker
FROM php:8.2-apache
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
curl \
|
|
libpng-dev \
|
|
libonig-dev \
|
|
libxml2-dev \
|
|
libcurl4-openssl-dev \
|
|
zip \
|
|
unzip \
|
|
whois
|
|
|
|
# Clear cache
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd curl
|
|
|
|
# Configure PHP upload limits
|
|
RUN echo "upload_max_filesize = 40M\npost_max_size = 50M" > /usr/local/etc/php/conf.d/uploads.ini
|
|
|
|
# Enable Apache mod_rewrite
|
|
RUN a2enmod rewrite
|
|
|
|
# Install Composer
|
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Configure Apache DocumentRoot to /var/www/html/public
|
|
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
|
|
|
|
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
|
|
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
|
|
|
# Copy application code
|
|
COPY . /var/www/html
|
|
|
|
# Set permissions
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
&& chmod -R 755 /var/www/html
|