大家好!我正在运行一个位于中国的服务器。我知道连接到 GitHub 和 npm 镜像很困难,所以我通过以下方式在 containers/app.yml 中设置了网络代理:
templates:
- "templates/web.china.template.yml"
...
env:
HTTP_PROXY: http://172.17.0.1:10808
HTTPS_PROXY: http://172.17.0.1:10808
ALL_PROXY: http://172.17.0.1:10808
这在 Discourse 在重建时使用 ember-cli 构建前端资源之前一直运行良好。所以我通过以下方式将 npm 注册表设置为镜像服务器(在中国):
hooks:
after_bundle_exec:
- exec:
cmd:
- su discourse -c 'git config --global http.proxy $HTTP_PROXY'
- su discourse -c 'git config --global http.proxy $HTTPS_PROXY'
- su discourse -c 'yarn config set registry https://registry.npmmirror.com/'
虽然这可以成功构建镜像,但在我需要升级实例时,执行 su discourse -c 'yarn install --production && yarn cache clean' 需要花费太长时间(超过 1900 秒)。
我想知道这是否正常,或者如何减少时间。谢谢!