我已经对节点红色 git 存储库和节点红色 docker 镜像进行了分支,并尝试修改 settings.js 文件以启用项目功能。最终出现在 Docker 容器中的设置文件似乎不是我修改过的。我的目标是在 Cloud Foundry 环境中使用 Docker 镜像。
https://github.com/andrewcgaitskellhs2/node-red-docker.git
https://github.com/andrewcgaitskellhs2/node-red.git
我还尝试在 Docker 构建时安装 git 和 ssh-keygen 以允许项目运行。我已将这些添加到 Node Red 应用程序和图像 git 存储库的 Package.json 文件中。
如果我需要从头开始,请告诉我需要采取哪些步骤。
我欢迎对此的指导。
谢谢。
最佳答案
您不应该尝试通过 package.json
文件安装 ssh-keygen 和 git。
您需要使用 Node-RED Dockerfile 作为构建新 Docker 容器的基础,在 Dockerfile 中您应该使用 apt-get 来安装它们并包含 settings.js 的编辑版本
类似这样的:
FROM nodered/node-red-docker
RUN apt-get install git ssh-client
COPY settings.js /data
ENV FLOWS=flows.json
ENV NODE_PATH=/usr/src/node-red/node_modules:/data/node_modules
CMD ["npm", "start", "--", "--userDir", "/data"]
其中 settings.js
是您编辑的版本,与 Dockerfile 位于同一目录中
编辑了@knolleary 的评论:
FROM nodered/node-red-docker
COPY settings.js /data
ENV FLOWS=flows.json
ENV NODE_PATH=/usr/src/node-red/node_modules:/data/node_modules
CMD ["npm", "start", "--", "--userDir", "/data"]
关于docker - 在node_red的Docker镜像中启用项目功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49088340/