# Use the official PHP image
FROM php:8.2-apache
RUN apt-get update -y && apt-get upgrade -y \
&& apt-get install -y libzip-dev zip \
&& docker-php-ext-install zip ctype iconv pdo_mysql \
&& a2enmod rewrite \
&& ln -sf /bin/bash /bin/sh
# Install imagick
RUN apt-get install -y libmagickwand-dev libmagickcore-dev git && \
git clone https://github.com/Imagick/imagick && \
cd imagick && \
phpize && \
./configure && \
make && \
make install
WORKDIR /var/www/html/symfonyproject
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Set Apache document root
ENV APACHE_DOCUMENT_ROOT=/var/www/html/symfonyproject/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf \
&& sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf