Docker-compose文件

This commit is contained in:
LyLme 2023-12-26 02:09:41 +08:00
parent f62b7806d9
commit 2cee11f5e5

64
docker-compose.yaml Normal file
View File

@ -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