为何Ant Design Pro以Docker方式运行会导致卡死?

新手上路,请多包涵

Ant Design Pro以Docker方式部署在开发环境时,宿主机CPU和磁盘占用均为100%,从而导致Docker卡死。

以下是Node容器日志

在构建MFSU时,CPU和磁盘占用也会100%,我以为构建完成就可以了,结果构建完成后还是100%的占用。

Dockerfile代码

FROM node:18.15.0-alpine3.17

WORKDIR /app

COPY package.json package-lock.json .

# 设置环境变量
ENV NODE_OPTIONS=--openssl-legacy-provider

# 安装依赖
RUN npm config set registry http://registry.npmmirror.com -g && npm install --no-cache

# 拷贝项目目录进来
COPY . .

EXPOSE 8000

CMD ["npm", "run", "start"]

docker-compose内容

version: '3.9'
services:
  backend:
    container_name: backend
    hostname: backend
    privileged: true
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - .:/go/src
      - ./app.yml:/go/bin/app.yml
    depends_on:
      - mysql
    restart: unless-stopped

  mysql:
    container_name: mysql
    hostname: mysql
    image: "mysql:5.7.34"
    ports:
      - "13306:3306"
    secrets:
      - db-root-password
    volumes:
      - ./docker/data/mysql:/var/lib/mysql
      - ./docker/mysql/my.cnf:/etc/my.cnf
    environment:
      - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-root-password
      - MYSQL_DATABASE=vita_task
      - MYSQL_USER=vitatask
      - MYSQL_PASSWORD=vitatask
    restart: unless-stopped

  nginx:
    container_name: nginx
    hostname: nginx
    image: nginx:latest
    ports:
      - "8880:80"
      - "8443:443"
    volumes:
      - "./docker/nginx/nginx.conf:/usr/local/openresty/nginx/nginx.conf"
      - "./docker/nginx/conf.d:/etc/nginx/conf.d"
      - ".:/var/www"
    depends_on:
      - backend
      - node
    restart: unless-stopped


  node:
    container_name: node
    hostname: node
    build:
      context: E:\Develop\Project\antdpro
      dockerfile: Dockerfile
    volumes:
        - E:\Develop\Project\antdpro\src:/app/src
        - E:\Develop\Project\antdpro\config:/app/config
    restart: unless-stopped

secrets:
  db-root-password:
    file: docker/mysql/root-password.txt
阅读 1.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏