将日期附加到URL以防止Docker缓存+;从Github检索最新提交

将日期附加到URL以防止Docker缓存+;从Github检索最新提交,docker,github,npm,npm-install,Docker,Github,Npm,Npm Install,我在Dockerfile中有这样一个文件: RUN npm install -g "https://github.com/ORESoftware/r2g?$(date +%s%N)" 但这会产生以下HTTP 400错误: [docker.r2g] npm ERR! Error while executing: [docker.r2g] npm ERR! /usr/bin/git ls-remote -h -t https://github.com/ORESoftware/r2g%3F152

我在Dockerfile中有这样一个文件:

RUN npm install -g "https://github.com/ORESoftware/r2g?$(date +%s%N)"
但这会产生以下HTTP 400错误:

[docker.r2g]  npm ERR! Error while executing:
[docker.r2g]  npm ERR! /usr/bin/git ls-remote -h -t https://github.com/ORESoftware/r2g%3F1527384219726226800.git
[docker.r2g]  npm ERR! 
[docker.r2g]  npm ERR! fatal: unable to access 'https://github.com/ORESoftware/r2g%3F1527384219726226800.git/': The requested URL returned error: 400
[docker.r2g]  npm ERR! 
[docker.r2g]  npm ERR! exited with error code: 128
[docker.r2g]  
[docker.r2g]  npm ERR! A complete log of this run can be found in:
[docker.r2g]  npm ERR!     /home/node/.npm/_logs/2018-05-27T01_23_41_453Z-debug.log
[docker.r2g]  The command '/bin/sh -c npm install -g "https://github.com/ORESoftware/r2g?$(date +%s%N)"' returned a non-zero code: 1
[docker.r2g]  
我的目的有两个:

  • 尝试不使用Docker缓存(包括新日期)
  • 还试图从Github获取最新信息(包括一个新的url)
  • 有人知道怎么做吗

    我也试过这两种方法:

    RUN npm install -g 'https://github.com/ORESoftware/r2g?'"$(date +%s%N)"
    


    无济于事。

    我认为其中一个应该做到这一点:

    RUN bash -c 'npm install --loglevel=warn -g "https://raw.githubusercontent.com/oresoftware/tarballs/master/tgz/oresoftware/r2g.tgz?$(date +%s)"'
    


    实际上,我认为是Github不喜欢带有查询参数的URL,而不是它的格式不正确。

    Quoting and teh?引发问题?尝试
    运行npm安装--loglevel=warn-g'https://github.com/ORESoftware/r2g?“$(日期+%s%N)”
    我试过了,不起作用,有点奇怪,总是出现http 400错误。我更新了问题,展示了我尝试的另外两种方式。
    RUN npm install -g https://github.com/ORESoftware/r2g?"$(date +%s%N)"
    
    RUN bash -c 'npm install --loglevel=warn -g "https://raw.githubusercontent.com/oresoftware/tarballs/master/tgz/oresoftware/r2g.tgz?$(date +%s)"'
    
    RUN npm install --loglevel=warn -g "https://raw.githubusercontent.com/oresoftware/tarballs/master/tgz/oresoftware/docker.r2g.tgz?$(date +%s)"