https://github.com/janishar/nodejs-backend-architecture-typescript 比如这个项目中, Install using Docker Compose [Recommended Method]
Clone this repo. Make a copy of .env.example file to .env. Make a copy of keys/private.pem.example file to keys/private.pem. Make a copy of keys/public.pem.example file to keys/public.pem. Make a copy of tests/.env.test.example file to tests/.env.test. Install Docker and Docker Compose. Find Instructions Here. Execute docker-compose up -d in terminal from the repo directory. You will be able to access the api from http://localhost:3000 If having any issue then make sure 3000 port is not occupied else provide a different port in .env file. If having any issue then make sure 27017 port is not occupied else provide a different port in .env file.
那我每次更新项目文件,我发现每次都得 docker rebuid 然后 restart 更新,有没有自动动态更新的方法
1
gzlock 2023-04-04 00:31:20 +08:00
你这要求已经超出 docker 的使用规范了吧
|
2
zbinlin 2023-04-04 00:41:43 +08:00
你是用 docker 还是 docker compose ?如果是 docker compose 并且是 v2 版的,可以用 `docker compose alpha watch` 命令。
如果是开发的话,或者不用 docker ,看它的 package.json 里有 watch 的 script ,可以直接用 `npm run watch`来开发。 |
3
Trim21 2023-04-04 00:51:22 +08:00
本地开发直接用宿主机的 nodejs 跑 nodemon 就好了
部属的时候才构建 docker 镜像然后推到服务器上。 |
4
IndieCreator OP @zbinlin 用的 docker compose ,谢谢我试试 docker compose alpha watch 命令
|
5
IndieCreator OP @Trim21 对 node 不是太熟,所以想怎么省事方便怎么来
|
6
DICK23 2023-04-04 16:05:55 +08:00
你这已经是要求对文件监控了
|
7
dendixx 2023-04-04 16:08:52 +08:00
@IndieCreator 方便就是 nodemon
|
8
zy445566 2023-04-11 11:50:01 +08:00
https://github.com/virtual-less/vaas-framework
我这个框架其实就实现了动态更新,有点类似 PHP |