version: '3.8'
services:
  php:
    image: php:7.3-fpm
    volumes:
      - /data/laravel_test:/var/www/html
    working_dir: /var/www/html
    networks:
      - laravel_net
    # 修正后的启动命令
    command: >
      sh -c "set -ex
      && apt-get update
      && apt-get install -y libzip-dev unzip
      && docker-php-ext-install pdo_mysql zip
      && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
      && composer install --no-dev --optimize-autoloader
      && php-fpm"

  nginx:
    image: nginx:1.18
    ports:
      - "80:80"
    volumes:
      - /data/laravel_test:/var/www/html
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    networks:
      - laravel_net

networks:
  laravel_net:
    driver: bridge