将日期附加到URL以防止Docker缓存+;从Github检索最新提交
我在Dockerfile中有这样一个文件:将日期附加到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
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]
我的目的有两个:
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)"