在托管git子模块的Docker中使用Yarn

alt

我有一个开发环境git repo,其中包含我的应用程序的所有各个组件作为子模块,并且每个子模块都有自己的docker容器,可将文件夹作为卷安装。

一些子模块也彼此需要,因此为了减少混乱,我只是将它们列在package.json中

{
 "dependencies": {
    //...
    "myapp-common": "https://path-to-my-repo.git",
   }
}

除了我需要yarn从Docker内部运行时,这可以正常工作在我使用时,node-sass会根据yarn正在运行的操作系统安装不同的软件包

我遇到的问题是当我运行yarn installetc时,出现此错误:

root@ea69cb8f4e7f:/app# yarn
yarn install v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads https://path-to-my-repo.git
Directory: /app
Output:
fatal: Not a git repository: ../.git/modules/myapp
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

任何想法如何解决这个问题?

alt

这不是最理想的选择,但是我已经通过创建一个bash脚本来临时移动.git文件来解决此问题

#!/bin/bash
mv /app/.git /app/.git.bak
yarn
mv /app/.git.bak /app/.git
yarn start

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章