目录结构
docker-compose.yml
version: '3.8'
#网络互通
networks:
webapp:
#声明服务
services:
#mysql服务
mysql5:
image: mysql:5.6
container_name: mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "123456"
volumes:
- "./services/mysql/Data:/var/lib/mysql"
- "./services/mysql/conf/my.cnf:/etc/mysql/conf.d/mysql.cnf"
- "./services/mysql/logs:/var/log/mysql"
restart: always
networks:
- webapp
#php-fpm-apache服务
myapache:
build:
context: ./services/php
container_name: phpApache
ports:
- "80:80"
volumes:
- "./services/php/conf/php.ini:/usr/local/etc/php/php.ini"
- "./services/php/logs:/www/wwwlogs"
- "./web/:/var/www/html"
- "./web/project:/project"
- "./web/dmdelivery-gui:/www/wwwroot/myInstall/dmdelivery-gui"
restart: always
networks:
- webapp
php的Dockerfile
FROM php:5.6-apache
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y default-libmysqlclient-dev bzip2 libbz2-dev libsasl2-dev curl git libfreetype6-dev libicu-dev libjpeg-dev libmcrypt-dev libpng-dev libpq-dev libxml2-dev \
&& docker-php-ext-install bcmath bz2 calendar iconv intl mbstring mcrypt mysqli opcache pdo_mysql pdo_pgsql pgsql soap zip \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd \
&& apt-get purge -y --auto-remove default-libmysqlclient-dev bzip2 libbz2-dev libsasl2-dev \
&& rm -r /var/lib/apt/lists/*
#CMD ln -s /www/wwwroot/myInstall/dmdelivery-gui /project/my.dmdelivery.com/libs/dmdelivery
COPY apache.conf /etc/apache2/sites-enabled/000-default.conf
# Install SUPERVISOR
RUN apt-get update \
&& apt-get install -y supervisor \
&& rm -rf /var/lib/apt/lists/*