50 lines
1.1 KiB
Docker
50 lines
1.1 KiB
Docker
FROM php:7.4-apache
|
|
|
|
# Install dependencies for PHP extensions
|
|
RUN apt-get update && apt-get install -y \
|
|
libpng-dev \
|
|
libjpeg-dev \
|
|
libfreetype6-dev \
|
|
libwebp-dev \
|
|
libxpm-dev \
|
|
pkg-config \
|
|
libonig-dev \
|
|
libxml2-dev \
|
|
libgmp-dev \
|
|
libsodium-dev \
|
|
unzip \
|
|
git \
|
|
zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Configure GD
|
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
|
|
|
# Install PHP extensions
|
|
RUN docker-php-ext-install gd mysqli opcache soap sodium gmp mbstring pdo_mysql
|
|
|
|
# Install Composer
|
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
|
|
# Set working directory
|
|
WORKDIR /var/www/html
|
|
|
|
# Copy project files
|
|
COPY application/composer.json ./
|
|
|
|
# Copy custom PHP settings
|
|
COPY php.ini /usr/local/etc/php/conf.d/custom.ini
|
|
|
|
# Copy the rest of the project
|
|
COPY . .
|
|
|
|
# Set permissions
|
|
RUN chown -R www-data:www-data /var/www/html \
|
|
&& chmod -R 755 /var/www/html
|
|
|
|
# Install PHP dependencies
|
|
RUN composer install --no-dev --optimize-autoloader
|
|
|
|
# Expose Apache port
|
|
EXPOSE 80
|