用于本地js依赖项开发的docker设置

时间:2018-06-29 18:31:00

标签: node.js git docker npm docker-compose

设置

  1. EC2上的Ubuntu 16.04 lts服务器。

  2. 基本docker-ce安装[1]。

  3. 安装node.js [2],并克隆此存储库以轻松描述我的问题[3]。

  4. 安装docker-compose。 [4]

  5. docker-compose up运行the-main-repo

  6. 它可以正常运行。

Recreating the-main-repo_app_1 ... done
Attaching to the-main-repo_app_1
app_1  | + the-dependency@1.0.0
app_1  | updated 1 package in 0.833s
app_1  | calling dep:
app_1  | hello from the dependency here...!
the-main-repo_app_1 exited with code 0

  1. node_modules干净地安装到了容器。 [5]

  2. 据我了解,挂载的作用是,它将挂载的目录从主机复制到映像上的目录。

  3. 现在,我的问题是,当我在main-repo上工作时,我不能使用npm link the-dependency(当然,在从依赖项运行npm link之后)。在当地发展依赖性。因为,npm链接似乎在docker容器中不起作用。

  4. 我不能只删除node_modules/the-dependencygit clone the-dependency node_modules/the-dependency,因为npm update不允许任何依赖项成为git存储库[6]。它拒绝更新它们,输入gitify-dependencies [7]似乎根本不适用于当前节点版本(8.x)!

  5. 我需要能够编辑依赖关系,并让docker容器使用最新代码运行。那么,如何将所有内容npm link + docker + git based dependency组合在一起?


[1]-https://docs.docker.com/install/linux/docker-ce/ubuntu/

[2]-https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04

[3]-http://github.com/gprasanth/the-main-repo/

[4]-https://docs.docker.com/compose/install/

[5]-http://jdlm.info/articles/2016/03/06/lessons-building-node-app-docker.html#the-node_modules-volume-trick

[6]-https://github.com/APSL/react-native-version-number/issues/13

[7]-https://github.com/contentful-labs/gitify-dependencies

0 个答案:

没有答案
相关问题