woweb的yii2容器化服务部署

version: '3.1'

networks:
  default:
    driver: bridge
    driver_opts:
      com.docker.network.enable_ipv6: "false"
    ipam:
      driver: default
      config:
        - subnet: 192.168.57.0/24

services:
  mysql:
    image: mysql:5.5.60
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: abc3.0123
    # links:
    ports:
      - 13306:3306
      # 13306端口是补人使用的,不能随便修改。
    volumes:
      - ./data/share/localtime:/etc/localtime:ro
      - ./data/share/timezone:/etc/timezone:ro
      - ./data/mysql/data:/var/lib/mysql

  php:
    image: yiisoftware/yii2-php:7.2-fpm
    restart: always
    ports:
      - 9900:9000
    links:
      - mysql:mysql
    extra_hosts:
      - mysql.woterm.com:abc.24.129.221
    depends_on:
      - mysql
    volumes:
      - ./data/share/localtime:/etc/localtime:ro
      - ./data/share/timezone:/etc/timezone:ro
      - ./data/wwwroot:/home/wwwroot
      - ./data/wwwlogs:/home/wwwlogs
      - ./../../woweb:/home/wwwroot/woweb
    # php-fpm运行的用户为www-data,需要将wwwroot的权限为[chmod a+w ]

  nginx:
    image: nginx:1.13.6
    restart: always
    ports:
      - 80:80
    links:
      - mysql
      - php
    depends_on:
      - mysql
      - php
    volumes:
      - ./data/share/localtime:/etc/localtime:ro
      - ./data/share/timezone:/etc/timezone:ro
      - ./data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./data/nginx/conf/vhost:/etc/nginx/vhost:ro
      - ./data/wwwroot:/home/wwwroot
      - ./data/wwwlogs:/home/wwwlogs
      - ./../../woweb:/home/wwwroot/woweb

  ftp:
    image: stilliard/pure-ftpd
    restart: always
    ports:
      - "21:21"
    volumes:
      - ./data/vsftp:/home/vsftp
    environment:
      FTP_USER_NAME: uftp
      FTP_USER_PASS: xxxxxxx
      FTP_USER_HOME: ./data/vsftp/home