Gatsby 不会在安装的代码更改时重建
Gatsby not rebuilding whenever mounted code changes
我使用了 gatsby-cli 提供的典型 gatsby init。而且,我想使用 docker 进一步自动化。
.
|- src
|- gatsby-*.js
|- node_modules
|- Dockerfile
|- docker-compose.yml
|- package*.json
|- public
这是我的 Dockerfile:
FROM node:12
# Add the package.json file and build the node_modules folder
WORKDIR /app
COPY ./package*.json ./
RUN mkdir node_modules && npm install
RUN npm install --global gatsby-cli && gatsby telemetry --disable
这是我的 docker-compose.yml
version: '3.7'
services:
gatsby:
build:
context: .
dockerfile: Dockerfile
working_dir: /app
command: gatsby develop -H 0.0.0.0
ports:
- "8000:8000"
volumes:
- .:/app
- /app/node_modules/
问题是,每当我在本地更改任何内容并且我已经通过进入容器内部来验证这一点以确保更改已复制到容器中时,这些更改不会触发构建。
我在访问本地主机中的公开端口时没有问题。我做错了什么吗?我已经验证构建确实 运行 但只有一次。在构建过程中没有错误的迹象,只有来自 npm 安装的 WARN 东西,这也是我在本地安装时的情况。
我想我没有正确使用 google 关键字。如果我只使用这个词,重新编译而不是重建。
https://github.com/gatsbyjs/gatsby/issues/10836
这对我有用。
我使用了 gatsby-cli 提供的典型 gatsby init。而且,我想使用 docker 进一步自动化。
.
|- src
|- gatsby-*.js
|- node_modules
|- Dockerfile
|- docker-compose.yml
|- package*.json
|- public
这是我的 Dockerfile:
FROM node:12
# Add the package.json file and build the node_modules folder
WORKDIR /app
COPY ./package*.json ./
RUN mkdir node_modules && npm install
RUN npm install --global gatsby-cli && gatsby telemetry --disable
这是我的 docker-compose.yml
version: '3.7'
services:
gatsby:
build:
context: .
dockerfile: Dockerfile
working_dir: /app
command: gatsby develop -H 0.0.0.0
ports:
- "8000:8000"
volumes:
- .:/app
- /app/node_modules/
问题是,每当我在本地更改任何内容并且我已经通过进入容器内部来验证这一点以确保更改已复制到容器中时,这些更改不会触发构建。
我在访问本地主机中的公开端口时没有问题。我做错了什么吗?我已经验证构建确实 运行 但只有一次。在构建过程中没有错误的迹象,只有来自 npm 安装的 WARN 东西,这也是我在本地安装时的情况。
我想我没有正确使用 google 关键字。如果我只使用这个词,重新编译而不是重建。
https://github.com/gatsbyjs/gatsby/issues/10836
这对我有用。