From 2cee11f5e5bebf5b3a1ecdbc42864733436432c9 Mon Sep 17 00:00:00 2001 From: LyLme Date: Tue, 26 Dec 2023 02:09:41 +0800 Subject: [PATCH] =?UTF-8?q?Docker-compose=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yaml | 64 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 docker-compose.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..63a291d --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,64 @@ +version: '3' +services: + php: + container_name: "spage-php74" + build: ./php + image: php74-fpm-alpine + # ports: + # - "9000:9000" #fpm 端口 + restart: always + volumes: + - ./php/etc:/usr/local/etc/php/conf.d #映射配置文件 + - ./www:/var/www/html + stdin_open: true + tty: true + links: + - "mysql" #链接mysql服务 + networks: + spage: + ipv4_address: 10.10.10.2 + environment: + - TZ=Asia/Shanghai # 设置时区 + nginx: + container_name: "spage-nginx" + image: nginx:latest + restart: always + ports: + - "8080:80" + environment: + - TZ=Asia/Shanghai + depends_on: + - "php" + links: + - "php" + volumes: + - ./nginx/conf.d:/etc/nginx/conf.d + #- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf + - ./nginx/log:/var/log/nginx/ + - ./www:/var/www/html + networks: + spage: + ipv4_address: 10.10.10.10 #分配ip + mysql: + container_name: "spage-mysql" + image: mysql:5.7 + # ports: + # - ":3306" + volumes: + - ./mysql/data:/var/lib/mysql #数据目录 + restart: always + environment: + - TZ=Asia/Shanghai + - MYSQL_ROOT_PASSWORD=123456 #MySQL root密码 + - MYSQL_DATABASE=spage #MySQL 数据库名 + networks: + spage: + ipv4_address: 10.10.10.1 #MySQL ip地址 +networks: + spage: + driver: bridge + driver_opts: + com.docker.network.enable_ipv6: "true" + ipam: + config: + - subnet: 10.10.0.0/16