Конфиг такой:
docker-compose:
version: '3.8'
services:
web:
build:
context: .
dockerfile: Dockerfile
image: php:7.3.30-apache
volumes:
- .:/var/www/html
depends_on:
- db
container_name: apache_web
restart: always
ports:
- "8080:80"
db:
container_name: db
image: mysql:5.7
restart: always
volumes:
- mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: rusapp
MYSQL_PASSWORD: root
ports:
- "3307:3306"
volumes:
mysql:
Dockerfile:
FROM php:7.3.30-apache
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
COPY . /var/www/html/
EXPOSE 80
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
RUN apt-get update -y
RUN a2enmod rewrite
RUN a2enmod headers
RUN a2enmod expires
RUN a2enmod autoindex
RUN apt-get install -y git
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN if command -v a2enmod >/dev/null 2>&1; then \
a2enmod rewrite headers \
;fi
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
ENV APACHE_DOCUMENT_ROOT /var/www/html/crm
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
RUN apt-get install -y imagemagick
RUN apt-get install -y libjpeg-dev libpng-dev
RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd
RUN apt-get install -y zlib1g-dev libicu-dev g++
RUN apt-get install -y libcurl4-openssl-dev
RUN docker-php-ext-install curl
RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
RUN apt-get install -y libexif-dev
RUN docker-php-ext-install exif
RUN docker-php-ext-install mysqli
RUN apt-get install -y libpq-dev libsqlite3-dev
RUN docker-php-ext-install pdo pdo_mysql pdo_sqlite
RUN docker-php-ext-install opcache
RUN apt-get install -y zlib1g-dev
RUN apt-get update && apt-get install -y libmcrypt-dev