小编Las*_*M4N的帖子

Dockerized Vue 应用程序 - 热重载不起作用

Dockerized Vue 应用程序正常加载到浏览器,当对代码应用更改时,如果不刷新则不会反映出来。

Dockerfile

FROM node:14-alpine

# make the 'app' folder the current working directory
WORKDIR /app

# copy 'package.json'
COPY package.json .

# install project dependencies
RUN npm install

# copy project files and folders to the current working directory (i.e. 'app' folder)
#COPY . .


EXPOSE 8080

CMD ["npm", "run", "serve"]
Run Code Online (Sandbox Code Playgroud)

docker-compose.yml

version: '3.9'
services:
  frontend:
    container_name: 'frontend'
    build: ./
    stdin_open: true
    tty: true
    ports:
      - '8080:8080'
    volumes:
      - ./:/app
      - /app/node_modules
    environment:
      - HOST=0.0.0.0
      - CHOKIDAR_USEPOLLING=true
Run Code Online (Sandbox Code Playgroud)

包.json …

docker vue.js dockerfile docker-compose hot-reload

3
推荐指数
2
解决办法
7726
查看次数

标签 统计

docker ×1

docker-compose ×1

dockerfile ×1

hot-reload ×1

vue.js ×1