Docker 停靠的NuxtJS应用程序不重新加载本地更改

Docker 停靠的NuxtJS应用程序不重新加载本地更改,docker,docker-compose,dockerfile,nuxt.js,Docker,Docker Compose,Dockerfile,Nuxt.js,我刚刚使用Docker和Docker compose对接了我的第一个NuxtJS应用程序。 除了我在本地进行更改时,运行中的docker没有反映我所做的更改之外,所有操作都很顺利 如何配置Docker容器以侦听代码中的本地更改?谢谢: Dockerfile: # Dockerfile FROM node:11.13.0-alpine # create destination directory RUN mkdir /myapp WORKDIR /myapp # Add current dir

我刚刚使用Docker和Docker compose对接了我的第一个NuxtJS应用程序。 除了我在本地进行更改时,运行中的docker没有反映我所做的更改之外,所有操作都很顺利

如何配置Docker容器以侦听代码中的本地更改?谢谢:

Dockerfile:

# Dockerfile
FROM node:11.13.0-alpine

# create destination directory
RUN mkdir /myapp
WORKDIR /myapp

# Add current directory code to working directory
ADD . /myapp/

# update and install dependency
RUN apk update && apk upgrade
RUN apk add git

RUN npm install

EXPOSE 3000

ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000

CMD gunicorn myapp.wsgi:application --bind $NUXT_HOST:$NUXT_PORT
Docker compose:

# Dockerfile
FROM node:11.13.0-alpine

# create destination directory
RUN mkdir /myapp
WORKDIR /myapp

# Add current directory code to working directory
ADD . /myapp/

# update and install dependency
RUN apk update && apk upgrade
RUN apk add git

RUN npm install

EXPOSE 3000

ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000

CMD gunicorn myapp.wsgi:application --bind $NUXT_HOST:$NUXT_PORT
版本:“3”
服务:
nuxt:
生成:。
命令:npm run dev
端口:
- "3000:3000"
环境:
-NUXT_主机=0.0.0.0
-NUXT_端口=3000
卷数:
-/myapp/
numxt.config.js:

# Dockerfile
FROM node:11.13.0-alpine

# create destination directory
RUN mkdir /myapp
WORKDIR /myapp

# Add current directory code to working directory
ADD . /myapp/

# update and install dependency
RUN apk update && apk upgrade
RUN apk add git

RUN npm install

EXPOSE 3000

ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000

CMD gunicorn myapp.wsgi:application --bind $NUXT_HOST:$NUXT_PORT
导出默认值{
//全局页眉(https://go.nuxtjs.dev/config-head)
负责人:{
标题:“myapp”,
元:[
{charset:'utf-8'},
{name:'viewport',content:'width=设备宽度,初始比例=1'},
{hid:'description',name:'description',content:',
],
链接:[{rel:'icon',键入:'image/x-icon',href:'/favicon.ico'}],
},
//全局CSS(https://go.nuxtjs.dev/config-css)
css:[],
//在呈现页面之前要运行的插件(https://go.nuxtjs.dev/config-plugins)
插件:[],
//自动导入组件(https://go.nuxtjs.dev/config-components)
组成部分:正确,
//开发和构建模块(推荐)(https://go.nuxtjs.dev/config-modules)
构建模块:[
// https://go.nuxtjs.dev/eslint
“@nuxtjs/eslint模块”,
// https://go.nuxtjs.dev/stylelint
“@nuxtjs/stylelint模块”,
],
//模块(https://go.nuxtjs.dev/config-modules)
模块:[
// https://go.nuxtjs.dev/buefy
“nuxt buefy”,
// https://go.nuxtjs.dev/axios
“@nuxtjs/axios”,
// https://go.nuxtjs.dev/pwa
“@nuxtjs/pwa”,
// https://go.nuxtjs.dev/content
“@numxt/content”,
],
//Axios模块配置(https://go.nuxtjs.dev/config-axios)
axios:{},
//内容模块配置(https://go.nuxtjs.dev/config-content)
内容:{},
//构建配置(https://go.nuxtjs.dev/config-build)
生成:{},
观察者:{
网页:{
民意调查:对
}
},
}

你从Docker那里得到了什么;为什么不使用主机的节点安装和
npm运行dev
?(特定的
卷:
语法为您的应用程序内容创建了一个匿名卷:您运行的不是主机的内容,也不是映像中的内容,而是应用程序的某个旧版本。我建议删除它以使用映像中内置的代码。您需要使用不同的语法,如
:/myapp
来替换图片内容与主机内容)谢谢David,这解决了我的问题。你能把它作为答案发布吗?