我正在尝试设置Wordpress+Gatsby Docker配置。整个Wordpress和数据库部分不是问题,并且运行良好。
但是盖茨比的部分更多的是一个问题。其想法是构建一个安装Gatsby CLI和节点模块的映像,同时将整个应用程序共享到本地文件夹。这是我使用Dockerfile
的位置
FROM node:14.11.0-alpine
RUN npm install -g gatsby-cli
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8000
CMD ["gatsby", "develop"]
这是图像的输出
gatsby_1 | ╔════════════════════════════════════════════════════════════════════════╗
gatsby_1 | ║ ║
gatsby_1 | ║ Gatsby collects anonymous usage analytics ║
gatsby_1 | ║ to help improve Gatsby for all users. ║
gatsby_1 | ║ ║
gatsby_1 | ║ If you'd like to opt-out, you can use `gatsby telemetry --disable` ║
gatsby_1 | ║ To learn more, checkout https://gatsby.dev/telemetry ║
gatsby_1 | ║ ║
gatsby_1 | ╚════════════════════════════════════════════════════════════════════════╝
gatsby_1 |
gatsby_1 | ERROR
gatsby_1 |
gatsby_1 | There was a problem loading the local develop command. Gatsby may not be installed in your site's "node_modules" directory. Perhaps you need to run "npm install"? You might need to delete your "package-lock.json" as well.
gatsby_1 |
wp-gatsby_gatsby_1 exited with code 1
但是,当我在运行开发服务器之前检查node_modules
中的内容时,我可以看到所有Gatsby模块。这是整个项目的回购。知道我错过了什么吗?
失败的命令是/bin/sh -c autoreconf -fiv
。您可以检查基础图像,发现它缺少autoconf
。你需要先安装它与:
RUN apk update && apk add autoconf
由于您提到了node_modules
:请确保在.dokerignore中有一个条目,否则命令COPY . .
将覆盖映像中已经安装的任何yarn install
。