gpt4 book ai didi

javascript - 我如何使用 docker Fig 自动加载代码更改

转载 作者:行者123 更新时间:2023-11-28 19:29:49 27 4
gpt4 key购买 nike

我有一个简单的 Node 程序app.js
我将包含文件夹的 app.js 文件安装到 Docker 容器中。
当我fig up时,它就起作用了。
但是,当我更改 app.js 的内容并再次执行 fig stopfig up 时,更改不会加载。
我如何确保每次打开无花果时都会重新加载/重建图像?

我尝试了各种组合,但没有成功。
如何解决这个问题?

最佳答案

只需安装该卷(无需在 Dockerfile 中实际使用 ADD)就可以帮助我在每次创建fig up时测试最新代码

app.js

var http = require('http');
http.createServer(函数(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(" Hello World 5");
}).听(3001);

Dockerfile
来自 cjonagam/centos-nodejs-0.10.33
运行 mkdir/home/test2
工作目录/home/test2
暴露3001


应用程序:
build : 。
卷:
- .:/home/test2
端口:
- “3001:3001”
命令: Node app.js

关于javascript - 我如何使用 docker Fig 自动加载代码更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27086483/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com