docker - 错误:下载 deno 导入时出现 429 Too Many Requests
问题描述
我正在将 deno 与 dockerhayd/alpine-deno
映像一起使用并denon
监视文件更改。当我构建容器时,我会429 Too Many Requests
导入std
依赖项:
...
Download https://deno.land/std@0.54.0/encoding/_yaml/type/int.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/map.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/merge.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/nil.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/omap.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/pairs.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/seq.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/set.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/str.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/timestamp.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/binary.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/bool.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/float.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/int.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/map.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/merge.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/nil.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/omap.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/pairs.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/seq.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/set.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/str.ts
Download https://deno.land/std@0.54.0/encoding/_yaml/type/timestamp.ts
error: Import 'https://deno.land/std@0.54.0/encoding/_yaml/type/timestamp.ts' failed: 429 Too Many Requests
我的外部依赖项在deps.ts
其中具有以下导入:
export { Application, Router } from 'https://deno.land/x/oak/mod.ts'
export { connect } from 'https://deno.land/x/redis/mod.ts'
除了 denon 导入之外,没有其他外部依赖项。
我用来运行它的 Dockerfile:
FROM hayd/alpine-deno:1.0.1
ENV DENO_DIR /cache
EXPOSE 4000
WORKDIR /app/
COPY . .
RUN deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts
RUN deno cache src/deps.ts
ENTRYPOINT ["/root/.deno/bin/denon"]
CMD ["run", "--allow-net", "src/mod.ts"]
似乎许多文件被多次下载(或尝试下载、失败并重试)。这并不总是发生,但经常足以破坏构建自动化。有没有人有类似的问题?缓存导入是否有问题?
解决方案
缓存导入是否有问题?
不,缓存与它无关。
它似乎deno.land
有速率限制,并且您超出了这些限制。您可以做的是直接使用 github,这很可能会有更高的限制。
供天龙使用
https://raw.githubusercontent.com/denosaurs/denon/master/denon.ts
您还可以更改代码依赖项:
改变https://deno.land/x/oak/mod.ts
_https://raw.githubusercontent.com/oakserver/oak/master/mod.ts
redis
你应该使用https://raw.githubusercontent.com/keroxp/deno-redis/master/mod.ts
https://deno.land/x只不过是一个 URL 重写服务器,所以最后,你实际上是从 Github 中提取的。
deno.land/x 是 Deno 脚本的 URL 重写服务。代码 URL 的基本格式是 https://deno.land/x/MODULE_NAME@BRANCH/SCRIPT.ts。如果省略分支,它将默认为模块的默认分支,通常是 master。
您应该使用标记版本,master
否则您的 docker 映像将不会始终具有相同的 Oak 代码。
为了v4.0.0
export { Application, Router } from 'https://github.com/oakserver/oak/blob/v4.0.0/mod.ts'
export { connect } from 'https://raw.githubusercontent.com/keroxp/deno-redis/v0.10.1/mod.ts
推荐阅读
- python - Boto3 ec2 describe_images 太慢了
- android - 是否可以让数据绑定为变量生成不可为空的访问器?
- amazon-web-services - 调用 API 网关跨账户时出错
- pandas - 在我老死之前尝试用 dataframe.to_hdf 加载 hdf5 表
- flutter - 停用和处置之间的区别?
- java - 到数据库日期的 SUM 天数
- javascript - 无法从页面底部向上滚动
- python - 在 beautifulsoup 元素的开头删除空白
- javascript - 不明白为什么这段代码在一种情况下有效,但在另一种情况下无效
- javascript - Angular 7 类型“void”不可分配给类型“ObservableInput<{}>”