代码之家  ›  专栏  ›  技术社区  ›  user977828

更改角度代码不会触发在docker中重新加载应用程序

  •  0
  • user977828  · 技术社区  · 6 年前

    here docker撰写项目:

    version: '3.1'
    
    services:
    
      nginx:
        container_name: nginx
        image: nginx
        build:
          context: .
          dockerfile: .docker/nginx.dockerfile
        volumes:
          - ./dist:/usr/share/nginx/html
        ports:
          - "80:80"
          - "443:443"
    
        networks:
          - app-network
    
      node:
        container_name: nodeapp
        image: nodeapp
        build:
          context: ./microservices/node
          dockerfile: .docker/node.development.dockerfile
        volumes:
          - ./microservices/node:/var/www/angularnoderestfulservice
        environment:
          - NODE_ENV=development
        ports:
          - "3000:3000"
        depends_on: 
          - mongodb
        networks:
          - app-network
    
      #No authentication is provided here - JUST A DEMO! That would absolutely
      #be needed for a "real" application
      mongodb:
        container_name: mongodb
        image: mongo
        networks:
          - app-network
    
      aspnet:
        container_name: 'aspnetcoreapp'
        image: 'aspnetcoreapp'
        build:
          context: ./microservices/aspnet_core
          dockerfile: .docker/aspnetcore.development.dockerfile
        volumes:
          - ./microservices/aspnet_core:/var/www/aspnetcoreapp
        ports:
         - "5000:5000"
        depends_on:
         - "postgres"
        networks:
          - app-network
    
      postgres:
        container_name: 'postgres'
        image: postgres
        environment:
          POSTGRES_PASSWORD: password
        networks:
          - app-network
    
      cadvisor:
        container_name: cadvisor
        image: google/cadvisor
        volumes:
          - /:/rootfs:ro
          - /var/run:/var/run:rw
          - /sys:/sys:ro
          - /var/lib/docker/:/var/lib/docker:ro
        ports:
          - "8080:8080"
        networks:
          - app-network
    
    networks:
      app-network:
        driver: bridge
    

    不幸的是,当我保存了 src/index.html

    我错过了什么?

    提前谢谢你,

    1 回复  |  直到 6 年前
        1
  •  0
  •   Siyu Zeeshan Akhter    6 年前

    当你使用nginx服务时,它提供了一个角度应用程序的构建版本(通过 ng build )在/dist文件夹中。您正在寻找angular的实时开发功能 ng serve

    看看这个回购协议 https://github.com/willcrisis/ng-docker/blob/master/README.md