version: '2'
services:
  # ---------------------------
  # 前台
  # ---------------------------
  spring-microservice-exam-web:
    image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-web:2.0
    volumes:
      # 挂载nginx的配置文件
      - ./nginx.conf:/etc/nginx/nginx.conf
    container_name: web-service
    env_file: docker-compose.env  # 从文件中获取配置
    restart: always
    ports:
      - "80:80"
    networks:
      - net

  # ---------------------------
  # 后台
  # ---------------------------
  spring-microservice-exam-ui:
    image: registry.cn-hangzhou.aliyuncs.com/spring-microservice-exam/spring-microservice-exam-ui:2.0
    volumes:
      # 挂载nginx的配置文件
      - ./nginx.conf:/etc/nginx/nginx.conf
    container_name: ui-service
    env_file: docker-compose.env  # 从文件中获取配置
    restart: always
    ports:
      - "81:80"
    networks:
      - net

networks:
  net:
    driver: bridge

volumes:
  data:
    driver: local